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/gallery-carousel.php +150 -84 1.0.16 → 1.3.18 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements;
3 4
4 5 use Elementor\Controls_Manager;
5 6 use Elementor\Group_Control_Background;
@@ -53,9 +54,9 @@
53 54 'carousel',
54 55 'animation', // hover animations
55 56 'entrance', // entrance basic style
56 57 ];
57 - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
58 + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) {
58 59 $styles['e-animations'] = [ // entrance animations
59 60 'external' => true,
60 61 ];
61 62 }
@@ -64,8 +65,13 @@
64 65 public function get_scripts()
65 66 {
66 67 return $this->TRAIT_get_carousel_scripts();
67 68 }
69 + public function has_widget_inner_wrapper(): bool
70 + {
71 + // TODO: remove after Optmized Markup experiment is merged to the core
72 + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
73 + }
68 74 protected function register_controls()
69 75 {
70 76 $this->TRAIT_register_gallery_repeater_controls('Content');
71 77 $this->TRAIT_register_additional_controls(true);
@@ -76,16 +82,16 @@
76 82 'label' => esc_html__('Carousel Settings', 'uicore-elements'),
77 83 'tab' => Controls_Manager::TAB_CONTENT,
78 84 ]
79 85 );
80 - $this->TRAIT_register_carousel_additional_controls();
81 - $this->add_control(
82 - 'divider',
83 - [
84 - 'type' => Controls_Manager::DIVIDER,
85 - ]
86 - );
87 - $this->TRAIT_register_carousel_settings_controls();
86 + $this->TRAIT_register_carousel_additional_controls();
87 + $this->add_control(
88 + 'divider',
89 + [
90 + 'type' => Controls_Manager::DIVIDER,
91 + ]
92 + );
93 + $this->TRAIT_register_carousel_settings_controls();
88 94
89 95 $this->end_controls_section();
90 96
91 97 $this->TRAIT_register_navigation_controls();
@@ -97,9 +103,9 @@
97 103 'tab' => Controls_Manager::TAB_STYLE,
98 104 ]
99 105 );
100 106
101 - $this->TRAIT_register_all_item_style_controls();
107 + $this->TRAIT_register_all_item_style_controls();
102 108
103 109 $this->end_controls_section();
104 110
105 111 $this->TRAIT_register_filters_style_controls();
@@ -117,9 +123,9 @@
117 123 [
118 124 'default' => 'none'
119 125 ]
120 126 );
121 - $this->update_control(
127 + $this->update_responsive_control(
122 128 'item_padding',
123 129 [
124 130 'default' => [
125 131 'top' => 10,
@@ -127,10 +133,10 @@
127 133 'bottom' => 10,
128 134 'left' => 10,
129 135 ],
130 136 'selectors' => [
131 - '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
132 - ],
137 + '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
138 + ],
133 139 ]
134 140 );
135 141 $this->update_control(
136 142 'item_border_radius',
@@ -144,13 +150,69 @@
144 150 ]
145 151 ]
146 152 );
147 153 $this->update_control(
148 - 'match_height', [
154 + 'match_height',
155 + [
149 156 'render_type' => 'template',
150 157 ]
151 158 );
152 159
160 + $image_conditions = [
161 + 'relation' => 'or',
162 + 'terms' => [
163 + [
164 + 'relation' => 'and',
165 + 'terms' => [
166 + [
167 + 'name' => 'layout',
168 + 'operator' => '==',
169 + 'value' => '',
170 + ],
171 + [
172 + 'name' => 'vertical',
173 + 'operator' => '!=',
174 + 'value' => 'true',
175 + ],
176 + ]
177 + ],
178 + [
179 + 'relation' => 'and',
180 + 'terms' => [
181 + [
182 + 'name' => 'layout',
183 + 'operator' => '==',
184 + 'value' => 'ui-e-overlay',
185 + ],
186 + [
187 + 'name' => 'match_height',
188 + 'operator' => '==',
189 + 'value' => 'yes',
190 + ],
191 + [
192 + 'name' => 'vertical',
193 + 'operator' => '!=',
194 + 'value' => 'true',
195 + ],
196 + ],
197 + ]
198 + ],
199 + ];
200 +
201 + $this->update_control(
202 + 'style_image_section',
203 + [
204 + 'conditions' => $image_conditions
205 + ]
206 + );
207 + $this->update_responsive_control(
208 + 'image_height',
209 + [
210 + 'conditions' => $image_conditions
211 + ]
212 + );
213 +
214 +
153 215 // Remove some useless component controls or group controls that can't be properly updated
154 216 $this->remove_control('item_background_background');
155 217 $this->remove_control('item_hover_background_background');
156 218 $this->remove_control('item_background_color');
@@ -157,33 +219,36 @@
157 219 $this->remove_control('item_background_image');
158 220 $this->remove_control('item_background_gradient');
159 221
160 222 // Inject new controls
161 - // TODO: release this feature after fixing compatibility issues with `fade_blur` and `circular`
162 - // $this->start_injection([
163 - // 'of' => 'animation_style',
164 - // 'at' => 'after',
165 - // ]);
223 + $this->start_injection([
224 + 'of' => 'animation_style',
225 + 'at' => 'after',
226 + ]);
166 227
167 - // $this->add_control(
168 - // 'main_image',
169 - // [
170 - // 'label' => __('Main image', 'uicore-elements'),
171 - // 'type' => Controls_Manager::SELECT,
172 - // 'default' => '',
173 - // 'options' => [
174 - // '' => esc_html__('Default', 'uicore-elements'),
175 - // 'ui-e-main-image-scale' => esc_html__('Scale', 'uicore-elements'),
176 - // 'ui-e-main-image-show' => esc_html__('Show Info', 'uicore-elements'),
177 - // 'ui-e-main-image-show_scale' => esc_html__('Show Info & Scale', 'uicore-elements'),
178 - // ],
179 - // 'prefix_class' => '',
180 - // 'render_type' => 'template',
181 - // 'frontend_available' => true,
182 - // ]
183 - // );
228 + $this->add_control(
229 + 'main_image',
230 + [
231 + 'label' => __('Main image', 'uicore-elements'),
232 + 'type' => Controls_Manager::SELECT,
233 + 'default' => '',
234 + 'options' => [
235 + '' => esc_html__('Default', 'uicore-elements'),
236 + 'ui-e-main-image-scale' => esc_html__('Scale', 'uicore-elements'),
237 + 'ui-e-main-image-show' => esc_html__('Show Info', 'uicore-elements'),
238 + 'ui-e-main-image-show_scale' => esc_html__('Show Info & Scale', 'uicore-elements'),
239 + ],
240 + 'description' => __('Works best with centered slides.', 'uicore-elements'),
241 + 'prefix_class' => '',
242 + 'render_type' => 'template',
243 + 'frontend_available' => true,
244 + 'condition' => [
245 + 'animation_style!' => 'marquee',
246 + ]
247 + ]
248 + );
184 249
185 - // $this->end_injection();
250 + $this->end_injection();
186 251
187 252 $this->start_injection([
188 253 'of' => 'item_border_border',
189 254 'at' => 'before',
@@ -188,29 +253,29 @@
188 253 'of' => 'item_border_border',
189 254 'at' => 'before',
190 255 ]);
191 256
192 - // normal background controls
193 - $this->add_group_control(
194 - Group_Control_Background::get_type(),
195 - [
196 - 'name' => 'item_gallery_background',
197 - 'selector' => '{{WRAPPER}} .ui-e-item',
198 - 'condition' => [
199 - 'layout' => '',
200 - ]
257 + // normal background controls
258 + $this->add_group_control(
259 + Group_Control_Background::get_type(),
260 + [
261 + 'name' => 'item_gallery_background',
262 + 'selector' => '{{WRAPPER}} .ui-e-item',
263 + 'condition' => [
264 + 'layout' => '',
201 265 ]
202 - );
203 - $this->add_group_control(
204 - Group_Control_Background::get_type(),
205 - [
206 - 'name' => 'item_content_background',
207 - 'selector' => '{{WRAPPER}} .ui-e-content',
208 - 'condition' => [
209 - 'layout' => 'ui-e-overlay',
210 - ]
266 + ]
267 + );
268 + $this->add_group_control(
269 + Group_Control_Background::get_type(),
270 + [
271 + 'name' => 'item_content_background',
272 + 'selector' => '{{WRAPPER}} .ui-e-content',
273 + 'condition' => [
274 + 'layout' => 'ui-e-overlay',
211 275 ]
212 - );
276 + ]
277 + );
213 278
214 279 $this->end_injection();
215 280
216 281 $this->start_injection([
@@ -217,29 +282,29 @@
217 282 'of' => 'item_hover_border_color',
218 283 'at' => 'before',
219 284 ]);
220 285
221 - // hover background controls
222 - $this->add_group_control(
223 - Group_Control_Background::get_type(),
224 - [
225 - 'name' => 'item_gallery_hover_background',
226 - 'selector' => '{{WRAPPER}} .ui-e-item:hover',
227 - 'condition' => [
228 - 'layout' => '',
229 - ]
286 + // hover background controls
287 + $this->add_group_control(
288 + Group_Control_Background::get_type(),
289 + [
290 + 'name' => 'item_gallery_hover_background',
291 + 'selector' => '{{WRAPPER}} .ui-e-item:hover',
292 + 'condition' => [
293 + 'layout' => '',
230 294 ]
231 - );
232 - $this->add_group_control(
233 - Group_Control_Background::get_type(),
234 - [
235 - 'name' => 'item_content_hover_background',
236 - 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
237 - 'condition' => [
238 - 'layout' => 'ui-e-overlay',
239 - ]
295 + ]
296 + );
297 + $this->add_group_control(
298 + Group_Control_Background::get_type(),
299 + [
300 + 'name' => 'item_content_hover_background',
301 + 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
302 + 'condition' => [
303 + 'layout' => 'ui-e-overlay',
240 304 ]
241 - );
305 + ]
306 + );
242 307
243 308 $this->end_injection();
244 309 }
245 310
@@ -245,16 +310,17 @@
245 310
246 311 public function render()
247 312 {
248 313 $settings = $this->get_settings_for_display();
249 - ?>
250 - <div class="ui-e-carousel swiper">
251 - <div class='swiper-wrapper'>
252 - <?php $this->TRAIT_render_gallery($settings, true); ?>
253 - </div>
254 - <?php $this->TRAIT_render_carousel_navigations(); ?>
314 + $total_slides = count($settings['gallery_items']);
315 + $this->TRAIT_render_center_loop_warning($total_slides);
316 +?>
317 + <div class="ui-e-carousel swiper">
318 + <div class='swiper-wrapper'>
319 + <?php $this->TRAIT_render_gallery($settings, true); ?>
255 320 </div>
256 - <?php
321 + </div>
322 + <?php $this->TRAIT_render_carousel_navigations($total_slides); ?>
323 +<?php
257 324 }
258 -
259 325 }
260 -\Elementor\Plugin::instance()->widgets_manager->register(new GalleryCarousel());
326 +\Elementor\Plugin::instance()->widgets_manager->register(new GalleryCarousel());