| @@ -321,8 +321,14 @@ | ||
| 321 | 321 | * https://wordpress.org/plugins/ultimate-member/ |
| 322 | 322 | */ |
| 323 | 323 | add_filter('um_email_send_message_content', [$this, 'filter_um_email_send_message_content']); |
| 324 | 324 | |
| 325 | + /** | |
| 326 | + * Shortcodes do not render when the Toolset template is used | |
| 327 | + * https://toolset.com/ | |
| 328 | + */ | |
| 329 | + add_filter('wpv_filter_content_template_output', [$this, 'filter_wpv_filter_content_template_output']); | |
| 330 | + | |
| 325 | 331 | /* Hooks */ |
| 326 | 332 | add_filter('post_row_actions', [$this, 'hook_wordpress_row_actions'], 10, 2); |
| 327 | 333 | add_filter('page_row_actions', [$this, 'hook_wordpress_row_actions'], 10, 2); |
| 328 | 334 | add_filter('user_row_actions', [$this, 'hook_wordpress_row_actions'], 10, 2); |
| @@ -824,8 +830,52 @@ | ||
| 824 | 830 | } |
| 825 | 831 | $this->helper->deset('wordpress_attachments_um'); |
| 826 | 832 | $this->helper->deset('wordpress_attachments_um_del'); |
| 827 | 833 | } |
| 834 | + } | |
| 835 | + | |
| 836 | + /** | |
| 837 | + * Enable / Disable pre-rendering of E2Pdf shortcodes in the Toolset template. | |
| 838 | + * https://toolset.com/ | |
| 839 | + */ | |
| 840 | + public function filter_wpv_filter_content_template_output($content) { | |
| 841 | + add_filter('render_block', [$this, 'filter_render_block_toolset_disable'], 9, 2); | |
| 842 | + add_filter('render_block', [$this, 'filter_render_block_toolset_enable'], 11, 2); | |
| 843 | + return $content; | |
| 844 | + } | |
| 845 | + | |
| 846 | + /** | |
| 847 | + * Disable pre-rendering of E2Pdf shortcodes in the Toolset template. | |
| 848 | + * https://toolset.com/ | |
| 849 | + */ | |
| 850 | + public function filter_render_block_toolset_disable($block_content, $block) { | |
| 851 | + if ( | |
| 852 | + !empty($block['blockName']) && strpos($block['blockName'], 'toolset-blocks/') === 0 && false !== strpos($block_content, '[e2pdf-') | |
| 853 | + ) { | |
| 854 | + remove_shortcode('e2pdf-download'); | |
| 855 | + remove_shortcode('e2pdf-view'); | |
| 856 | + remove_shortcode('e2pdf-save'); | |
| 857 | + remove_shortcode('e2pdf-zapier'); | |
| 858 | + remove_shortcode('e2pdf-adobesign'); | |
| 859 | + } | |
| 860 | + return $block_content; | |
| 861 | + } | |
| 862 | + | |
| 863 | + /** | |
| 864 | + * Enable rendering of E2Pdf shortcodes in the Toolset template. | |
| 865 | + * https://toolset.com/ | |
| 866 | + */ | |
| 867 | + public function filter_render_block_toolset_enable($block_content, $block) { | |
| 868 | + if ( | |
| 869 | + !empty($block['blockName']) && strpos($block['blockName'], 'toolset-blocks/') === 0 && false !== strpos($block_content, '[e2pdf-') | |
| 870 | + ) { | |
| 871 | + add_shortcode('e2pdf-download', [new Model_E2pdf_Shortcode(), 'e2pdf_download']); | |
| 872 | + add_shortcode('e2pdf-view', [new Model_E2pdf_Shortcode(), 'e2pdf_view']); | |
| 873 | + add_shortcode('e2pdf-save', [new Model_E2pdf_Shortcode(), 'e2pdf_save']); | |
| 874 | + add_shortcode('e2pdf-zapier', [new Model_E2pdf_Shortcode(), 'e2pdf_zapier']); | |
| 875 | + add_shortcode('e2pdf-adobesign', [new Model_E2pdf_Shortcode(), 'e2pdf_adobesign']); | |
| 876 | + } | |
| 877 | + return $block_content; | |
| 828 | 878 | } |
| 829 | 879 | |
| 830 | 880 | // filter content |
| 831 | 881 | public function filter_content($content, $post_id = false, $wp_reset_postdata = true) { |