PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.1
Elementor Website Builder – more than just a page builder v3.8.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / groups / background.php

background.php in Elementor Website Builder – more than just a page builder 3.8.1, at includes/controls/groups/background.php

824 lines 22.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
5 use Elementor\Modules\DynamicTags\Module as TagsModule;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 /**
12 * Elementor background control.
13 *
14 * A base control for creating background control. Displays input fields to define
15 * the background color, background image, background gradient or background video.
16 *
17 * @since 1.2.2
18 */
19 class Group_Control_Background extends Group_Control_Base {
20
21 /**
22 * Fields.
23 *
24 * Holds all the background control fields.
25 *
26 * @since 1.2.2
27 * @access protected
28 * @static
29 *
30 * @var array Background control fields.
31 */
32 protected static $fields;
33
34 /**
35 * Background Types.
36 *
37 * Holds all the available background types.
38 *
39 * @since 1.2.2
40 * @access private
41 * @static
42 *
43 * @var array
44 */
45 private static $background_types;
46
47 /**
48 * Get background control type.
49 *
50 * Retrieve the control type, in this case `background`.
51 *
52 * @since 1.0.0
53 * @access public
54 * @static
55 *
56 * @return string Control type.
57 */
58 public static function get_type() {
59 return 'background';
60 }
61
62 /**
63 * Get background control types.
64 *
65 * Retrieve available background types.
66 *
67 * @since 1.2.2
68 * @access public
69 * @static
70 *
71 * @return array Available background types.
72 */
73 public static function get_background_types() {
74 if ( null === self::$background_types ) {
75 self::$background_types = self::get_default_background_types();
76 }
77
78 return self::$background_types;
79 }
80
81 /**
82 * Get Default background types.
83 *
84 * Retrieve background control initial types.
85 *
86 * @since 2.0.0
87 * @access private
88 * @static
89 *
90 * @return array Default background types.
91 */
92 private static function get_default_background_types() {
93 return [
94 'classic' => [
95 'title' => _x( 'Classic', 'Background Control', 'elementor' ),
96 'icon' => 'eicon-paint-brush',
97 ],
98 'gradient' => [
99 'title' => _x( 'Gradient', 'Background Control', 'elementor' ),
100 'icon' => 'eicon-barcode',
101 ],
102 'video' => [
103 'title' => _x( 'Video', 'Background Control', 'elementor' ),
104 'icon' => 'eicon-video-camera',
105 ],
106 'slideshow' => [
107 'title' => _x( 'Slideshow', 'Background Control', 'elementor' ),
108 'icon' => 'eicon-slideshow',
109 ],
110 ];
111 }
112
113 /**
114 * Init fields.
115 *
116 * Initialize background control fields.
117 *
118 * @since 1.2.2
119 * @access public
120 *
121 * @return array Control fields.
122 */
123 public function init_fields() {
124 $fields = [];
125
126 $fields['background'] = [
127 'label' => _x( 'Background Type', 'Background Control', 'elementor' ),
128 'type' => Controls_Manager::CHOOSE,
129 'render_type' => 'ui',
130 ];
131
132 $fields['color'] = [
133 'label' => _x( 'Color', 'Background Control', 'elementor' ),
134 'type' => Controls_Manager::COLOR,
135 'default' => '',
136 'title' => _x( 'Background Color', 'Background Control', 'elementor' ),
137 'selectors' => [
138 '{{SELECTOR}}' => 'background-color: {{VALUE}};',
139 ],
140 'condition' => [
141 'background' => [ 'classic', 'gradient' ],
142 ],
143 ];
144
145 $fields['color_stop'] = [
146 'label' => _x( 'Location', 'Background Control', 'elementor' ),
147 'type' => Controls_Manager::SLIDER,
148 'size_units' => [ '%' ],
149 'default' => [
150 'unit' => '%',
151 'size' => 0,
152 ],
153 'render_type' => 'ui',
154 'condition' => [
155 'background' => [ 'gradient' ],
156 ],
157 'of_type' => 'gradient',
158 ];
159
160 $fields['color_b'] = [
161 'label' => _x( 'Second Color', 'Background Control', 'elementor' ),
162 'type' => Controls_Manager::COLOR,
163 'default' => '#f2295b',
164 'render_type' => 'ui',
165 'condition' => [
166 'background' => [ 'gradient' ],
167 ],
168 'of_type' => 'gradient',
169 ];
170
171 $fields['color_b_stop'] = [
172 'label' => _x( 'Location', 'Background Control', 'elementor' ),
173 'type' => Controls_Manager::SLIDER,
174 'size_units' => [ '%' ],
175 'default' => [
176 'unit' => '%',
177 'size' => 100,
178 ],
179 'render_type' => 'ui',
180 'condition' => [
181 'background' => [ 'gradient' ],
182 ],
183 'of_type' => 'gradient',
184 ];
185
186 $fields['gradient_type'] = [
187 'label' => _x( 'Type', 'Background Control', 'elementor' ),
188 'type' => Controls_Manager::SELECT,
189 'options' => [
190 'linear' => _x( 'Linear', 'Background Control', 'elementor' ),
191 'radial' => _x( 'Radial', 'Background Control', 'elementor' ),
192 ],
193 'default' => 'linear',
194 'render_type' => 'ui',
195 'condition' => [
196 'background' => [ 'gradient' ],
197 ],
198 'of_type' => 'gradient',
199 ];
200
201 $fields['gradient_angle'] = [
202 'label' => _x( 'Angle', 'Background Control', 'elementor' ),
203 'type' => Controls_Manager::SLIDER,
204 'size_units' => [ 'deg' ],
205 'default' => [
206 'unit' => 'deg',
207 'size' => 180,
208 ],
209 'range' => [
210 'deg' => [
211 'step' => 10,
212 ],
213 ],
214 'selectors' => [
215 '{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
216 ],
217 'condition' => [
218 'background' => [ 'gradient' ],
219 'gradient_type' => 'linear',
220 ],
221 'of_type' => 'gradient',
222 ];
223
224 $fields['gradient_position'] = [
225 'label' => _x( 'Position', 'Background Control', 'elementor' ),
226 'type' => Controls_Manager::SELECT,
227 'options' => [
228 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
229 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
230 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
231 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
232 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
233 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
234 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
235 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
236 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
237 ],
238 'default' => 'center center',
239 'selectors' => [
240 '{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
241 ],
242 'condition' => [
243 'background' => [ 'gradient' ],
244 'gradient_type' => 'radial',
245 ],
246 'of_type' => 'gradient',
247 ];
248
249 $fields['image'] = [
250 'label' => _x( 'Image', 'Background Control', 'elementor' ),
251 'type' => Controls_Manager::MEDIA,
252 'dynamic' => [
253 'active' => true,
254 ],
255 'responsive' => true,
256 'title' => _x( 'Background Image', 'Background Control', 'elementor' ),
257 'selectors' => [
258 '{{SELECTOR}}' => 'background-image: url("{{URL}}");',
259 ],
260 'render_type' => 'template',
261 'condition' => [
262 'background' => [ 'classic' ],
263 ],
264 ];
265
266 $fields['position'] = [
267 'label' => _x( 'Position', 'Background Control', 'elementor' ),
268 'type' => Controls_Manager::SELECT,
269 'default' => '',
270 'responsive' => true,
271 'options' => [
272 '' => _x( 'Default', 'Background Control', 'elementor' ),
273 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
274 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
275 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
276 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
277 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
278 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
279 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
280 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
281 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
282 'initial' => _x( 'Custom', 'Background Control', 'elementor' ),
283
284 ],
285 'selectors' => [
286 '{{SELECTOR}}' => 'background-position: {{VALUE}};',
287 ],
288 'condition' => [
289 'background' => [ 'classic' ],
290 'image[url]!' => '',
291 ],
292 ];
293
294 $fields['xpos'] = [
295 'label' => _x( 'X Position', 'Background Control', 'elementor' ),
296 'type' => Controls_Manager::SLIDER,
297 'responsive' => true,
298 'size_units' => [ 'px', 'em', '%', 'vw' ],
299 'default' => [
300 'unit' => 'px',
301 'size' => 0,
302 ],
303 'tablet_default' => [
304 'unit' => 'px',
305 'size' => 0,
306 ],
307 'mobile_default' => [
308 'unit' => 'px',
309 'size' => 0,
310 ],
311 'range' => [
312 'px' => [
313 'min' => -800,
314 'max' => 800,
315 ],
316 'em' => [
317 'min' => -100,
318 'max' => 100,
319 ],
320 '%' => [
321 'min' => -100,
322 'max' => 100,
323 ],
324 'vw' => [
325 'min' => -100,
326 'max' => 100,
327 ],
328 ],
329 'selectors' => [
330 '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
331 ],
332 'condition' => [
333 'background' => [ 'classic' ],
334 'position' => [ 'initial' ],
335 'image[url]!' => '',
336 ],
337 'required' => true,
338 ];
339
340 $fields['ypos'] = [
341 'label' => _x( 'Y Position', 'Background Control', 'elementor' ),
342 'type' => Controls_Manager::SLIDER,
343 'responsive' => true,
344 'size_units' => [ 'px', 'em', '%', 'vh' ],
345 'default' => [
346 'unit' => 'px',
347 'size' => 0,
348 ],
349 'tablet_default' => [
350 'unit' => 'px',
351 'size' => 0,
352 ],
353 'mobile_default' => [
354 'unit' => 'px',
355 'size' => 0,
356 ],
357 'range' => [
358 'px' => [
359 'min' => -800,
360 'max' => 800,
361 ],
362 'em' => [
363 'min' => -100,
364 'max' => 100,
365 ],
366 '%' => [
367 'min' => -100,
368 'max' => 100,
369 ],
370 'vh' => [
371 'min' => -100,
372 'max' => 100,
373 ],
374 ],
375 'selectors' => [
376 '{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
377 ],
378 'condition' => [
379 'background' => [ 'classic' ],
380 'position' => [ 'initial' ],
381 'image[url]!' => '',
382 ],
383 'required' => true,
384 ];
385
386 $fields['attachment'] = [
387 'label' => _x( 'Attachment', 'Background Control', 'elementor' ),
388 'type' => Controls_Manager::SELECT,
389 'default' => '',
390 'options' => [
391 '' => _x( 'Default', 'Background Control', 'elementor' ),
392 'scroll' => _x( 'Scroll', 'Background Control', 'elementor' ),
393 'fixed' => _x( 'Fixed', 'Background Control', 'elementor' ),
394 ],
395 'selectors' => [
396 '(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};',
397 ],
398 'condition' => [
399 'background' => [ 'classic' ],
400 'image[url]!' => '',
401 ],
402 ];
403
404 $fields['attachment_alert'] = [
405 'type' => Controls_Manager::RAW_HTML,
406 'content_classes' => 'elementor-control-field-description',
407 'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ),
408 'separator' => 'none',
409 'condition' => [
410 'background' => [ 'classic' ],
411 'image[url]!' => '',
412 'attachment' => 'fixed',
413 ],
414 ];
415
416 $fields['repeat'] = [
417 'label' => _x( 'Repeat', 'Background Control', 'elementor' ),
418 'type' => Controls_Manager::SELECT,
419 'default' => '',
420 'responsive' => true,
421 'options' => [
422 '' => _x( 'Default', 'Background Control', 'elementor' ),
423 'no-repeat' => _x( 'No-repeat', 'Background Control', 'elementor' ),
424 'repeat' => _x( 'Repeat', 'Background Control', 'elementor' ),
425 'repeat-x' => _x( 'Repeat-x', 'Background Control', 'elementor' ),
426 'repeat-y' => _x( 'Repeat-y', 'Background Control', 'elementor' ),
427 ],
428 'selectors' => [
429 '{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
430 ],
431 'condition' => [
432 'background' => [ 'classic' ],
433 'image[url]!' => '',
434 ],
435 ];
436
437 $fields['size'] = [
438 'label' => _x( 'Size', 'Background Control', 'elementor' ),
439 'type' => Controls_Manager::SELECT,
440 'responsive' => true,
441 'default' => '',
442 'options' => [
443 '' => _x( 'Default', 'Background Control', 'elementor' ),
444 'auto' => _x( 'Auto', 'Background Control', 'elementor' ),
445 'cover' => _x( 'Cover', 'Background Control', 'elementor' ),
446 'contain' => _x( 'Contain', 'Background Control', 'elementor' ),
447 'initial' => _x( 'Custom', 'Background Control', 'elementor' ),
448 ],
449 'selectors' => [
450 '{{SELECTOR}}' => 'background-size: {{VALUE}};',
451 ],
452 'condition' => [
453 'background' => [ 'classic' ],
454 'image[url]!' => '',
455 ],
456 ];
457
458 $fields['bg_width'] = [
459 'label' => _x( 'Width', 'Background Control', 'elementor' ),
460 'type' => Controls_Manager::SLIDER,
461 'responsive' => true,
462 'size_units' => [ 'px', 'em', '%', 'vw' ],
463 'range' => [
464 'px' => [
465 'min' => 0,
466 'max' => 1000,
467 ],
468 '%' => [
469 'min' => 0,
470 'max' => 100,
471 ],
472 'vw' => [
473 'min' => 0,
474 'max' => 100,
475 ],
476 ],
477 'default' => [
478 'size' => 100,
479 'unit' => '%',
480 ],
481 'required' => true,
482 'selectors' => [
483 '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
484
485 ],
486 'condition' => [
487 'background' => [ 'classic' ],
488 'size' => [ 'initial' ],
489 'image[url]!' => '',
490 ],
491 ];
492
493 $fields['video_link'] = [
494 'label' => _x( 'Video Link', 'Background Control', 'elementor' ),
495 'type' => Controls_Manager::TEXT,
496 'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E',
497 'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ),
498 'label_block' => true,
499 'default' => '',
500 'dynamic' => [
501 'active' => true,
502 'categories' => [
503 TagsModule::POST_META_CATEGORY,
504 TagsModule::URL_CATEGORY,
505 ],
506 ],
507 'condition' => [
508 'background' => [ 'video' ],
509 ],
510 'of_type' => 'video',
511 'frontend_available' => true,
512 ];
513
514 $fields['video_start'] = [
515 'label' => esc_html__( 'Start Time', 'elementor' ),
516 'type' => Controls_Manager::NUMBER,
517 'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ),
518 'placeholder' => 10,
519 'condition' => [
520 'background' => [ 'video' ],
521 ],
522 'of_type' => 'video',
523 'frontend_available' => true,
524 ];
525
526 $fields['video_end'] = [
527 'label' => esc_html__( 'End Time', 'elementor' ),
528 'type' => Controls_Manager::NUMBER,
529 'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ),
530 'placeholder' => 70,
531 'condition' => [
532 'background' => [ 'video' ],
533 ],
534 'of_type' => 'video',
535 'frontend_available' => true,
536 ];
537
538 $fields['play_once'] = [
539 'label' => esc_html__( 'Play Once', 'elementor' ),
540 'type' => Controls_Manager::SWITCHER,
541 'condition' => [
542 'background' => [ 'video' ],
543 ],
544 'of_type' => 'video',
545 'frontend_available' => true,
546 ];
547
548 $fields['play_on_mobile'] = [
549 'label' => esc_html__( 'Play On Mobile', 'elementor' ),
550 'type' => Controls_Manager::SWITCHER,
551 'condition' => [
552 'background' => [ 'video' ],
553 ],
554 'of_type' => 'video',
555 'frontend_available' => true,
556 ];
557
558 // This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy
559 // Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos
560 // will not run properly. This added control allows users to align all their videos to one host (either
561 // youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not).
562 $fields['privacy_mode'] = [
563 'label' => esc_html__( 'Privacy Mode', 'elementor' ),
564 'type' => Controls_Manager::SWITCHER,
565 'description' => esc_html__( 'Only works for YouTube videos.', 'elementor' ),
566 'condition' => [
567 'background' => [ 'video' ],
568 ],
569 'of_type' => 'video',
570 'frontend_available' => true,
571 ];
572
573 $fields['video_fallback'] = [
574 'label' => _x( 'Background Fallback', 'Background Control', 'elementor' ),
575 'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ),
576 'type' => Controls_Manager::MEDIA,
577 'dynamic' => [
578 'active' => true,
579 ],
580 'condition' => [
581 'background' => [ 'video' ],
582 ],
583 'selectors' => [
584 '{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;',
585 ],
586 'of_type' => 'video',
587 ];
588
589 $fields['slideshow_gallery'] = [
590 'label' => _x( 'Images', 'Background Control', 'elementor' ),
591 'type' => Controls_Manager::GALLERY,
592 'condition' => [
593 'background' => [ 'slideshow' ],
594 ],
595 'show_label' => false,
596 'of_type' => 'slideshow',
597 'frontend_available' => true,
598 ];
599
600 $fields['slideshow_loop'] = [
601 'label' => esc_html__( 'Infinite Loop', 'elementor' ),
602 'type' => Controls_Manager::SWITCHER,
603 'default' => 'yes',
604 'condition' => [
605 'background' => [ 'slideshow' ],
606 ],
607 'of_type' => 'slideshow',
608 'frontend_available' => true,
609 ];
610
611 $fields['slideshow_slide_duration'] = [
612 'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)',
613 'type' => Controls_Manager::NUMBER,
614 'default' => 5000,
615 'condition' => [
616 'background' => [ 'slideshow' ],
617 ],
618 'frontend_available' => true,
619 ];
620
621 $fields['slideshow_slide_transition'] = [
622 'label' => esc_html__( 'Transition', 'elementor' ),
623 'type' => Controls_Manager::SELECT,
624 'default' => 'fade',
625 'options' => [
626 'fade' => 'Fade',
627 'slide_right' => 'Slide Right',
628 'slide_left' => 'Slide Left',
629 'slide_up' => 'Slide Up',
630 'slide_down' => 'Slide Down',
631 ],
632 'condition' => [
633 'background' => [ 'slideshow' ],
634 ],
635 'of_type' => 'slideshow',
636 'frontend_available' => true,
637 ];
638
639 $fields['slideshow_transition_duration'] = [
640 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
641 'type' => Controls_Manager::NUMBER,
642 'default' => 500,
643 'condition' => [
644 'background' => [ 'slideshow' ],
645 ],
646 'frontend_available' => true,
647 ];
648
649 $fields['slideshow_background_size'] = [
650 'label' => esc_html__( 'Background Size', 'elementor' ),
651 'type' => Controls_Manager::SELECT,
652 'responsive' => true,
653 'default' => '',
654 'options' => [
655 '' => esc_html__( 'Default', 'elementor' ),
656 'auto' => esc_html__( 'Auto', 'elementor' ),
657 'cover' => esc_html__( 'Cover', 'elementor' ),
658 'contain' => esc_html__( 'Contain', 'elementor' ),
659 ],
660 'selectors' => [
661 '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
662 ],
663 'condition' => [
664 'background' => [ 'slideshow' ],
665 ],
666 ];
667
668 $fields['slideshow_background_position'] = [
669 'label' => esc_html__( 'Background Position', 'elementor' ),
670 'type' => Controls_Manager::SELECT,
671 'default' => '',
672 'responsive' => true,
673 'options' => [
674 '' => esc_html__( 'Default', 'elementor' ),
675 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
676 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
677 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
678 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
679 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
680 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
681 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
682 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
683 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
684 ],
685 'selectors' => [
686 '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
687 ],
688 'condition' => [
689 'background' => [ 'slideshow' ],
690 ],
691 ];
692
693 $fields['slideshow_lazyload'] = [
694 'label' => esc_html__( 'Lazyload', 'elementor' ),
695 'type' => Controls_Manager::SWITCHER,
696 'separator' => 'before',
697 'condition' => [
698 'background' => [ 'slideshow' ],
699 ],
700 'of_type' => 'slideshow',
701 'frontend_available' => true,
702 ];
703
704 $fields['slideshow_ken_burns'] = [
705 'label' => esc_html__( 'Ken Burns Effect', 'elementor' ),
706 'type' => Controls_Manager::SWITCHER,
707 'separator' => 'before',
708 'condition' => [
709 'background' => [ 'slideshow' ],
710 ],
711 'of_type' => 'slideshow',
712 'frontend_available' => true,
713 ];
714
715 $fields['slideshow_ken_burns_zoom_direction'] = [
716 'label' => esc_html__( 'Direction', 'elementor' ),
717 'type' => Controls_Manager::SELECT,
718 'default' => 'in',
719 'options' => [
720 'in' => esc_html__( 'In', 'elementor' ),
721 'out' => esc_html__( 'Out', 'elementor' ),
722 ],
723 'condition' => [
724 'background' => [ 'slideshow' ],
725 'slideshow_ken_burns!' => '',
726 ],
727 'of_type' => 'slideshow',
728 'frontend_available' => true,
729 ];
730
731 return $fields;
732 }
733
734 /**
735 * Get child default args.
736 *
737 * Retrieve the default arguments for all the child controls for a specific group
738 * control.
739 *
740 * @since 1.2.2
741 * @access protected
742 *
743 * @return array Default arguments for all the child controls.
744 */
745 protected function get_child_default_args() {
746 return [
747 'types' => [ 'classic', 'gradient' ],
748 'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer',
749 ];
750 }
751
752 /**
753 * Filter fields.
754 *
755 * Filter which controls to display, using `include`, `exclude`, `condition`
756 * and `of_type` arguments.
757 *
758 * @since 1.2.2
759 * @access protected
760 *
761 * @return array Control fields.
762 */
763 protected function filter_fields() {
764 $fields = parent::filter_fields();
765
766 $args = $this->get_args();
767
768 foreach ( $fields as &$field ) {
769 if ( isset( $field['of_type'] ) && ! in_array( $field['of_type'], $args['types'] ) ) {
770 unset( $field );
771 }
772 }
773
774 return $fields;
775 }
776
777 /**
778 * Prepare fields.
779 *
780 * Process background control fields before adding them to `add_control()`.
781 *
782 * @since 1.2.2
783 * @access protected
784 *
785 * @param array $fields Background control fields.
786 *
787 * @return array Processed fields.
788 */
789 protected function prepare_fields( $fields ) {
790 $args = $this->get_args();
791
792 $background_types = self::get_background_types();
793
794 $choose_types = [];
795
796 foreach ( $args['types'] as $type ) {
797 if ( isset( $background_types[ $type ] ) ) {
798 $choose_types[ $type ] = $background_types[ $type ];
799 }
800 }
801
802 $fields['background']['options'] = $choose_types;
803
804 return parent::prepare_fields( $fields );
805 }
806
807 /**
808 * Get default options.
809 *
810 * Retrieve the default options of the background control. Used to return the
811 * default options while initializing the background control.
812 *
813 * @since 1.9.0
814 * @access protected
815 *
816 * @return array Default background control options.
817 */
818 protected function get_default_options() {
819 return [
820 'popover' => false,
821 ];
822 }
823 }
824