| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements; |
| 4 | + | |
| 3 | 5 | use Elementor\Controls_Manager; |
| 4 | 6 | use UiCoreElements\UiCoreWidget; |
| 5 | 7 | use UiCoreElements\Utils\Carousel_Trait; |
| 6 | 8 | use UiCoreElements\Utils\Logo_Trait; |
| @@ -51,9 +53,9 @@ | ||
| 51 | 53 | 'carousel', |
| 52 | 54 | 'animation', // hover animations |
| 53 | 55 | 'entrance', // entrance basic style |
| 54 | 56 | ]; |
| 55 | - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ | |
| 57 | + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) { | |
| 56 | 58 | $styles['e-animations'] = [ // entrance animations |
| 57 | 59 | 'external' => true, |
| 58 | 60 | ]; |
| 59 | 61 | } |
| @@ -62,12 +64,13 @@ | ||
| 62 | 64 | public function get_scripts() |
| 63 | 65 | { |
| 64 | 66 | return $this->TRAIT_get_carousel_scripts(); |
| 65 | 67 | } |
| 66 | - // TODO: remove or set as false, after 3.30, when the full deprecation of widget innet wrapper is ready | |
| 67 | - public function has_widget_inner_wrapper(): bool { | |
| 68 | - return true; | |
| 69 | - } | |
| 68 | + public function has_widget_inner_wrapper(): bool | |
| 69 | + { | |
| 70 | + // TODO: remove after Optmized Markup experiment is merged to the core | |
| 71 | + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup'); | |
| 72 | + } | |
| 70 | 73 | protected function register_controls() |
| 71 | 74 | { |
| 72 | 75 | |
| 73 | 76 | $this->TRAIT_register_logo_repeater_controls('Logo Carousel Items'); // Repeater Controls |
| @@ -72,18 +75,18 @@ | ||
| 72 | 75 | |
| 73 | 76 | $this->TRAIT_register_logo_repeater_controls('Logo Carousel Items'); // Repeater Controls |
| 74 | 77 | |
| 75 | 78 | $this->start_controls_section( |
| 76 | - 'section_carousel_settings', | |
| 77 | - [ | |
| 78 | - 'label' => __('Carousel Settings', 'uicore-elements'), | |
| 79 | - ] | |
| 80 | - ); | |
| 79 | + 'section_carousel_settings', | |
| 80 | + [ | |
| 81 | + 'label' => __('Carousel Settings', 'uicore-elements'), | |
| 82 | + ] | |
| 83 | + ); | |
| 81 | 84 | |
| 82 | - $this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals | |
| 83 | - $this->TRAIT_register_logo_adittional_controls(); | |
| 84 | - $this->add_control('add_carousel_divider',['type' => Controls_Manager::DIVIDER,]); | |
| 85 | - $this->TRAIT_register_carousel_settings_controls(); // Carousel settings | |
| 85 | + $this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals | |
| 86 | + $this->TRAIT_register_logo_adittional_controls(); | |
| 87 | + $this->add_control('add_carousel_divider', ['type' => Controls_Manager::DIVIDER,]); | |
| 88 | + $this->TRAIT_register_carousel_settings_controls(); // Carousel settings | |
| 86 | 89 | |
| 87 | 90 | $this->end_controls_section(); |
| 88 | 91 | |
| 89 | 92 | $this->TRAIT_register_navigation_controls(); // Navigation settings |
| @@ -88,48 +91,48 @@ | ||
| 88 | 91 | |
| 89 | 92 | $this->TRAIT_register_navigation_controls(); // Navigation settings |
| 90 | 93 | |
| 91 | 94 | $this->start_controls_section( |
| 92 | - 'section_style_review_items', | |
| 93 | - [ | |
| 94 | - 'label' => esc_html__( 'Logo Carousel', 'uicore-elements' ), | |
| 95 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 96 | - ] | |
| 97 | - ); | |
| 95 | + 'section_style_review_items', | |
| 96 | + [ | |
| 97 | + 'label' => esc_html__('Logo Carousel', 'uicore-elements'), | |
| 98 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 99 | + ] | |
| 100 | + ); | |
| 98 | 101 | |
| 99 | - $this->start_controls_tabs( 'tabs_item_style' ); | |
| 102 | + $this->start_controls_tabs('tabs_item_style'); | |
| 100 | 103 | |
| 101 | - $this->start_controls_tab( | |
| 102 | - 'tab_item_normal', | |
| 103 | - [ | |
| 104 | - 'label' => esc_html__( 'Normal', 'uicore-elements' ), | |
| 105 | - ] | |
| 106 | - ); | |
| 107 | - $this->TRAIT_register_normal_item_style_controls(false); | |
| 108 | - $this->TRAIT_register_logos_image_style_controls('normal'); | |
| 109 | - $this->end_controls_tab(); | |
| 104 | + $this->start_controls_tab( | |
| 105 | + 'tab_item_normal', | |
| 106 | + [ | |
| 107 | + 'label' => esc_html__('Normal', 'uicore-elements'), | |
| 108 | + ] | |
| 109 | + ); | |
| 110 | + $this->TRAIT_register_normal_item_style_controls(false); | |
| 111 | + $this->TRAIT_register_logos_image_style_controls('normal'); | |
| 112 | + $this->end_controls_tab(); | |
| 110 | 113 | |
| 111 | - $this->start_controls_tab( | |
| 112 | - 'tab_item_hover', | |
| 113 | - [ | |
| 114 | - 'label' => esc_html__( 'Hover', 'uicore-elements' ), | |
| 115 | - ] | |
| 116 | - ); | |
| 117 | - $this->TRAIT_register_hover_item_style_controls(false); | |
| 118 | - $this->TRAIT_register_logos_image_style_controls('hover'); | |
| 119 | - $this->end_controls_tab(); | |
| 114 | + $this->start_controls_tab( | |
| 115 | + 'tab_item_hover', | |
| 116 | + [ | |
| 117 | + 'label' => esc_html__('Hover', 'uicore-elements'), | |
| 118 | + ] | |
| 119 | + ); | |
| 120 | + $this->TRAIT_register_hover_item_style_controls(false); | |
| 121 | + $this->TRAIT_register_logos_image_style_controls('hover'); | |
| 122 | + $this->end_controls_tab(); | |
| 120 | 123 | |
| 121 | - $this->start_controls_tab( | |
| 122 | - 'tab_item_active', | |
| 123 | - [ | |
| 124 | - 'label' => esc_html__( 'Active', 'uicore-elements' ), | |
| 125 | - ] | |
| 126 | - ); | |
| 127 | - $this->TRAIT_register_active_item_style_controls(false); | |
| 128 | - $this->TRAIT_register_logos_image_style_controls('active'); | |
| 129 | - $this->end_controls_tabs(); | |
| 124 | + $this->start_controls_tab( | |
| 125 | + 'tab_item_active', | |
| 126 | + [ | |
| 127 | + 'label' => esc_html__('Active', 'uicore-elements'), | |
| 128 | + ] | |
| 129 | + ); | |
| 130 | + $this->TRAIT_register_active_item_style_controls(false); | |
| 131 | + $this->TRAIT_register_logos_image_style_controls('active'); | |
| 132 | + $this->end_controls_tabs(); | |
| 130 | 133 | |
| 131 | - $this->end_controls_tabs(); // Necessary because register_testimonial_card_controls() OPENS but DON'T close start_controls_tabs() | |
| 134 | + $this->end_controls_tabs(); // Necessary because register_testimonial_card_controls() OPENS but DON'T close start_controls_tabs() | |
| 132 | 135 | |
| 133 | 136 | $this->end_controls_section(); |
| 134 | 137 | |
| 135 | 138 | $this->TRAIT_register_navigation_style_controls(); // Carousel Navigation Styles |
| @@ -141,19 +144,19 @@ | ||
| 141 | 144 | 'tab' => Controls_Manager::TAB_STYLE, |
| 142 | 145 | ] |
| 143 | 146 | ); |
| 144 | 147 | |
| 145 | - $this->TRAIT_register_entrance_animations_controls(); | |
| 146 | - $this->TRAIT_register_hover_animation_control( | |
| 147 | - 'Item Hover Animation', | |
| 148 | - [], | |
| 149 | - ['underline'] | |
| 150 | - ); | |
| 151 | - $this->TRAIT_register_hover_animation_control( | |
| 152 | - 'Logo Hover Animation', | |
| 153 | - [], | |
| 154 | - ['underline'] | |
| 155 | - ); | |
| 148 | + $this->TRAIT_register_entrance_animations_controls(); | |
| 149 | + $this->TRAIT_register_hover_animation_control( | |
| 150 | + 'Item Hover Animation', | |
| 151 | + [], | |
| 152 | + ['underline'] | |
| 153 | + ); | |
| 154 | + $this->TRAIT_register_hover_animation_control( | |
| 155 | + 'Logo Hover Animation', | |
| 156 | + [], | |
| 157 | + ['underline'] | |
| 158 | + ); | |
| 156 | 159 | |
| 157 | 160 | $this->end_controls_section(); |
| 158 | 161 | |
| 159 | 162 | // Remove unused logo control |
| @@ -160,15 +163,17 @@ | ||
| 160 | 163 | $this->remove_control('height'); |
| 161 | 164 | } |
| 162 | 165 | public function render() |
| 163 | 166 | { |
| 164 | - ?> | |
| 165 | - <div class="ui-e-carousel swiper"> | |
| 166 | - <div class='swiper-wrapper'> | |
| 167 | - <?php $this->TRAIT_render_logo_item(); ?> | |
| 168 | - </div> | |
| 167 | + $total_slides = count($this->get_settings_for_display('logo_list')); | |
| 168 | + $this->TRAIT_render_center_loop_warning($total_slides); | |
| 169 | +?> | |
| 170 | + <div class="ui-e-carousel swiper"> | |
| 171 | + <div class='swiper-wrapper'> | |
| 172 | + <?php $this->TRAIT_render_logo_item(); ?> | |
| 169 | 173 | </div> |
| 170 | - <?php $this->TRAIT_render_carousel_navigations(); ?> | |
| 171 | - <?php | |
| 174 | + </div> | |
| 175 | + <?php $this->TRAIT_render_carousel_navigations($total_slides); ?> | |
| 176 | +<?php | |
| 172 | 177 | } |
| 173 | 178 | } |
| 174 | -\Elementor\Plugin::instance()->widgets_manager->register(new LogoCarousel()); | |
| 179 | +\Elementor\Plugin::instance()->widgets_manager->register(new LogoCarousel()); | |