PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.18
UiCore Elements – Free widgets and templates for Elementor v1.3.18
1.3.18 1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 All 42 releases
← All changes | includes/widgets/testimonial-carousel.php +75 -81 1.2.1 → 1.3.18 View file →
@@ -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\Testimonial_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 }
@@ -69,11 +71,12 @@
69 71 ]
70 72 ];
71 73 return array_merge($scripts, $this->TRAIT_get_carousel_scripts());
72 74 }
73 - // TODO: remove or set as false, after 3.30, when the full deprecation of widget innet wrapper is ready
74 - public function has_widget_inner_wrapper(): bool {
75 - return true;
75 + public function has_widget_inner_wrapper(): bool
76 + {
77 + // TODO: remove after Optmized Markup experiment is merged to the core
78 + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
76 79 }
77 80 protected function register_controls()
78 81 {
79 82
@@ -87,22 +90,22 @@
87 90 'tab' => Controls_Manager::TAB_CONTENT,
88 91 ]
89 92 );
90 93
91 - $this->TRAIT_register_specific_testimonial_controls('layout');
92 - $this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals
93 - $this->TRAIT_register_testimonial_additional_controls(); // Testimonial Additionals
94 + $this->TRAIT_register_specific_testimonial_controls('layout');
95 + $this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals
96 + $this->TRAIT_register_testimonial_additional_controls(); // Testimonial Additionals
94 97
95 98 $this->end_controls_section();
96 99
97 100 $this->start_controls_section(
98 - 'section_carousel_settings',
99 - [
100 - 'label' => __('Carousel Settings', 'uicore-elements'),
101 - ]
102 - );
101 + 'section_carousel_settings',
102 + [
103 + 'label' => __('Carousel Settings', 'uicore-elements'),
104 + ]
105 + );
103 106
104 - $this->TRAIT_register_carousel_settings_controls(); // Carousel settings
107 + $this->TRAIT_register_carousel_settings_controls(); // Carousel settings
105 108
106 109 $this->end_controls_section();
107 110
108 111 $this->TRAIT_register_navigation_controls(); // Navigation settings
@@ -107,58 +110,58 @@
107 110
108 111 $this->TRAIT_register_navigation_controls(); // Navigation settings
109 112
110 113 $this->start_controls_section(
111 - 'section_style_review_items',
112 - [
113 - 'label' => esc_html__( 'Items', 'uicore-elements' ),
114 - 'tab' => Controls_Manager::TAB_STYLE,
115 - ]
116 - );
114 + 'section_style_review_items',
115 + [
116 + 'label' => esc_html__('Items', 'uicore-elements'),
117 + 'tab' => Controls_Manager::TAB_STYLE,
118 + ]
119 + );
117 120
118 - // move it to specific controls
119 - $this->add_control(
120 - 'item_gap',
121 - [
122 - 'label' => esc_html__( 'Inner Content Spacing', 'uicore-elements' ),
123 - 'type' => Controls_Manager::SLIDER,
124 - 'size_units' => [ 'px', '%', 'em' ],
125 - 'range' => [
126 - 'px' => [
127 - 'min' => 0,
128 - 'max' => 50,
129 - 'step' => 1,
130 - ],
131 - '%' => [
132 - 'min' => 0,
133 - 'max' => 100,
134 - ],
121 + // move it to specific controls
122 + $this->add_control(
123 + 'item_gap',
124 + [
125 + 'label' => esc_html__('Inner Content Spacing', 'uicore-elements'),
126 + 'type' => Controls_Manager::SLIDER,
127 + 'size_units' => ['px', '%', 'em'],
128 + 'range' => [
129 + 'px' => [
130 + 'min' => 0,
131 + 'max' => 50,
132 + 'step' => 1,
135 133 ],
136 - 'default' => [
137 - 'unit' => 'px',
138 - 'size' => 15,
134 + '%' => [
135 + 'min' => 0,
136 + 'max' => 100,
139 137 ],
140 - 'selectors' => [
141 - '{{WRAPPER}} .ui-e-testimonial-flex' => 'margin-bottom: {{SIZE}}{{UNIT}};',
142 - ],
143 - 'conditions' => [
144 - 'relation' => 'and',
145 - 'terms' => [
146 - [
147 - 'name' => 'image_inline',
148 - 'operator' => '===',
149 - 'value' => 'yes',
150 - ],
151 - [
152 - 'name' => 'layout',
153 - 'operator' => 'in',
154 - 'value' => ['layout_2'],
155 - ],
138 + ],
139 + 'default' => [
140 + 'unit' => 'px',
141 + 'size' => 15,
142 + ],
143 + 'selectors' => [
144 + '{{WRAPPER}} .ui-e-testimonial-flex' => 'margin-bottom: {{SIZE}}{{UNIT}};',
145 + ],
146 + 'conditions' => [
147 + 'relation' => 'and',
148 + 'terms' => [
149 + [
150 + 'name' => 'image_inline',
151 + 'operator' => '===',
152 + 'value' => 'yes',
156 153 ],
154 + [
155 + 'name' => 'layout',
156 + 'operator' => 'in',
157 + 'value' => ['layout_2'],
158 + ],
157 159 ],
158 - ]
159 - );
160 - $this->TRAIT_register_all_item_style_controls();
160 + ],
161 + ]
162 + );
163 + $this->TRAIT_register_all_item_style_controls();
161 164
162 165 $this->end_controls_section();
163 166
164 167 $this->TRAIT_register_style_controls(); // All Testimonial components styles
@@ -171,9 +174,9 @@
171 174 'tab' => Controls_Manager::TAB_STYLE,
172 175 ]
173 176 );
174 177
175 - $this->TRAIT_register_testimonial_animation_controls();
178 + $this->TRAIT_register_testimonial_animation_controls();
176 179
177 180 $this->end_controls_section();
178 181
179 182 // We need to set border radius as variable to use item radius on other components on swiper elements
@@ -187,29 +190,20 @@
187 190 public function render()
188 191 {
189 192 $settings = $this->get_settings_for_display();
190 193 $total_slides = count($settings['review_items']);
191 -
192 - ?>
193 - <div class="ui-e-carousel swiper">
194 - <div class='swiper-wrapper'>
195 - <?php
196 - foreach ( $settings['review_items'] as $index => $item ) :
197 - $this->TRAIT_render_review_item($item, $settings['layout']);
198 - endforeach;
199 -
200 - // Most recent swiper versions requires, if loop, at least one extra slide compared to visible slides
201 - if( $this->TRAIT_should_duplicate_slides($total_slides)) {
202 - $diff = $this->TRAIT_get_duplication_diff($total_slides);
203 - for($i = 0; $i <= $diff; $i++){
204 - $index = $i % $total_slides; // Ensure the index does not surpass the maximum index
205 - $this->TRAIT_render_review_item($settings['review_items'][$index], $settings['layout']);
206 - }
207 - }
208 - ?>
209 - </div>
194 + $this->TRAIT_render_center_loop_warning($total_slides);
195 +?>
196 + <div class="ui-e-carousel swiper">
197 + <div class='swiper-wrapper'>
198 + <?php
199 + foreach ($settings['review_items'] as $index => $item) :
200 + $this->TRAIT_render_review_item($item, $settings['layout']);
201 + endforeach;
202 + ?>
210 203 </div>
211 - <?php $this->TRAIT_render_carousel_navigations(); ?>
212 - <?php
204 + </div>
205 + <?php $this->TRAIT_render_carousel_navigations($total_slides); ?>
206 +<?php
213 207 }
214 208 }
215 -\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialCarousel());
209 +\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialCarousel());