| @@ -321,12 +321,30 @@ | ||
| 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); |
| 335 | + | |
| 336 | + // extension hooks | |
| 337 | + add_filter('e2pdf_extension_hooks', function ($hooks) { | |
| 338 | + $hooks[$this->info['key'] . '_-3'] = [ | |
| 339 | + 'hook_wordpress_row_actions' => __('WP Admin User Row Actions', 'e2pdf') | |
| 340 | + ]; | |
| 341 | + $hooks[$this->info['key']] = [ | |
| 342 | + 'hook_wordpress_page_edit' => __('WP Admin Page Edit', 'e2pdf'), | |
| 343 | + 'hook_wordpress_row_actions' => __('WP Admin Page Row Actions', 'e2pdf') | |
| 344 | + ]; | |
| 345 | + return $hooks; | |
| 346 | + }); | |
| 329 | 347 | } |
| 330 | 348 | |
| 331 | 349 | // load actions |
| 332 | 350 | public function load_actions() { |
| @@ -824,8 +842,52 @@ | ||
| 824 | 842 | } |
| 825 | 843 | $this->helper->deset('wordpress_attachments_um'); |
| 826 | 844 | $this->helper->deset('wordpress_attachments_um_del'); |
| 827 | 845 | } |
| 846 | + } | |
| 847 | + | |
| 848 | + /** | |
| 849 | + * Enable / Disable pre-rendering of E2Pdf shortcodes in the Toolset template. | |
| 850 | + * https://toolset.com/ | |
| 851 | + */ | |
| 852 | + public function filter_wpv_filter_content_template_output($content) { | |
| 853 | + add_filter('render_block', [$this, 'filter_render_block_toolset_disable'], 9, 2); | |
| 854 | + add_filter('render_block', [$this, 'filter_render_block_toolset_enable'], 11, 2); | |
| 855 | + return $content; | |
| 856 | + } | |
| 857 | + | |
| 858 | + /** | |
| 859 | + * Disable pre-rendering of E2Pdf shortcodes in the Toolset template. | |
| 860 | + * https://toolset.com/ | |
| 861 | + */ | |
| 862 | + public function filter_render_block_toolset_disable($block_content, $block) { | |
| 863 | + if ( | |
| 864 | + !empty($block['blockName']) && strpos($block['blockName'], 'toolset-blocks/') === 0 && false !== strpos($block_content, '[e2pdf-') | |
| 865 | + ) { | |
| 866 | + remove_shortcode('e2pdf-download'); | |
| 867 | + remove_shortcode('e2pdf-view'); | |
| 868 | + remove_shortcode('e2pdf-save'); | |
| 869 | + remove_shortcode('e2pdf-zapier'); | |
| 870 | + remove_shortcode('e2pdf-adobesign'); | |
| 871 | + } | |
| 872 | + return $block_content; | |
| 873 | + } | |
| 874 | + | |
| 875 | + /** | |
| 876 | + * Enable rendering of E2Pdf shortcodes in the Toolset template. | |
| 877 | + * https://toolset.com/ | |
| 878 | + */ | |
| 879 | + public function filter_render_block_toolset_enable($block_content, $block) { | |
| 880 | + if ( | |
| 881 | + !empty($block['blockName']) && strpos($block['blockName'], 'toolset-blocks/') === 0 && false !== strpos($block_content, '[e2pdf-') | |
| 882 | + ) { | |
| 883 | + add_shortcode('e2pdf-download', [new Model_E2pdf_Shortcode(), 'e2pdf_download']); | |
| 884 | + add_shortcode('e2pdf-view', [new Model_E2pdf_Shortcode(), 'e2pdf_view']); | |
| 885 | + add_shortcode('e2pdf-save', [new Model_E2pdf_Shortcode(), 'e2pdf_save']); | |
| 886 | + add_shortcode('e2pdf-zapier', [new Model_E2pdf_Shortcode(), 'e2pdf_zapier']); | |
| 887 | + add_shortcode('e2pdf-adobesign', [new Model_E2pdf_Shortcode(), 'e2pdf_adobesign']); | |
| 888 | + } | |
| 889 | + return $block_content; | |
| 828 | 890 | } |
| 829 | 891 | |
| 830 | 892 | // filter content |
| 831 | 893 | public function filter_content($content, $post_id = false, $wp_reset_postdata = true) { |