manifest.php
90 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ShopEngine\Compatibility\Conflicts; |
| 4 | |
| 5 | use ShopEngine\Widgets\Widget_Helper; |
| 6 | |
| 7 | class Manifest { |
| 8 | |
| 9 | public function init() { |
| 10 | add_action('shopengine/templates/elementor/content/before', [$this, 'theme_conflicts_in_widget']); |
| 11 | add_action('elementor/element/before_section_start', [$this, 'elementor_editor_conflict'], 10, 2); |
| 12 | add_action('elementor/element/before_section_start', function ($element) { |
| 13 | |
| 14 | /** |
| 15 | * In woodmart theme image with gallery does not work properly. so temporary fix |
| 16 | * Hooks tried are - |
| 17 | * elementor/editor/before_enqueue_scripts |
| 18 | * elementor/element/before_section_start |
| 19 | * elementor/element/after_section_end |
| 20 | */ |
| 21 | wp_enqueue_script('flexslider'); |
| 22 | |
| 23 | /** |
| 24 | * remove unwanted breadcrumb in shop and archive page |
| 25 | */ |
| 26 | remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
| 27 | remove_action('woocommerce_before_single_product', 'woocommerce_output_all_notices', 10); |
| 28 | |
| 29 | }, 9000, 1); |
| 30 | } |
| 31 | |
| 32 | public function theme_conflicts_in_widget($template_type) { |
| 33 | |
| 34 | if(in_array($template_type, ['shop', 'archive'])) { |
| 35 | |
| 36 | Theme_Hooks::instance()->theme__conflicts__shop_and_archive(); |
| 37 | |
| 38 | } elseif(in_array($template_type, ['single'])) { |
| 39 | |
| 40 | Theme_Hooks::instance()->theme__conflicts__single_page(); |
| 41 | |
| 42 | } elseif(in_array($template_type, ['cart'])) { |
| 43 | |
| 44 | Theme_Hooks::instance()->theme_conflicts_cart_page(); |
| 45 | |
| 46 | } elseif(in_array($template_type, ['my_account'])) { |
| 47 | |
| 48 | Theme_Hooks::instance()->theme_conflicts_my_account_page(); |
| 49 | |
| 50 | } elseif(in_array($template_type, ['empty_cart'])) { |
| 51 | |
| 52 | Theme_Hooks::instance()->theme_conflicts_empty_cart_page(); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | public function elementor_editor_conflict($element, $section_id) { |
| 57 | |
| 58 | $in_editor_mode = \Elementor\Plugin::$instance->editor->is_edit_mode(); |
| 59 | |
| 60 | if('shopengine-cross-sells' === $element->get_name() && $in_editor_mode) { |
| 61 | |
| 62 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_cross_sells(); |
| 63 | |
| 64 | } elseif('shopengine-related' === $element->get_name() && $in_editor_mode) { |
| 65 | |
| 66 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_related_products(); |
| 67 | |
| 68 | } elseif('shopengine-account-dashboard' === $element->get_name() && $in_editor_mode) { |
| 69 | |
| 70 | Theme_Hooks::instance()->theme_conflicts_my_account_page(); |
| 71 | |
| 72 | } elseif('shopengine-cart-table' === $element->get_name() && $in_editor_mode) { |
| 73 | |
| 74 | Theme_Hooks::instance()->theme_conflicts_empty_cart_page(); |
| 75 | |
| 76 | } elseif('shopengine-archive-products' === $element->get_name() && $in_editor_mode) { |
| 77 | |
| 78 | Theme_Hooks::instance()->theme_conflicts_in_editor__archive_products_widget(); |
| 79 | |
| 80 | } elseif('shopengine-product-tabs' === $element->get_name() && $in_editor_mode) { |
| 81 | |
| 82 | Theme_Hooks::instance()->theme_conflicts_in_editor__product_tabs_widget(); |
| 83 | |
| 84 | } elseif('shopengine-up-sells' === $element->get_name() && $in_editor_mode) { |
| 85 | |
| 86 | Theme_Hooks::instance()->theme_conflicts_in_elementor_editor_up_sells(); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 |