PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.3
Elementor Website Builder – more than just a page builder v3.17.3
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.17.3, at includes/controls/groups/background.php

817 lines 21.2 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' => esc_html__( 'Classic', 'elementor' ),
96 'icon' => 'eicon-paint-brush',
97 ],
98 'gradient' => [
99 'title' => esc_html__( 'Gradient', 'elementor' ),
100 'icon' => 'eicon-barcode',
101 ],
102 'video' => [
103 'title' => esc_html__( 'Video', 'elementor' ),
104 'icon' => 'eicon-video-camera',
105 ],
106 'slideshow' => [
107 'title' => esc_html__( 'Slideshow', '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' => esc_html__( 'Background Type', 'elementor' ),
128 'type' => Controls_Manager::CHOOSE,
129 'render_type' => 'ui',
130 ];
131
132 $fields['color'] = [
133 'label' => esc_html__( 'Color', 'elementor' ),
134 'type' => Controls_Manager::COLOR,
135 'default' => '',
136 'title' => esc_html__( 'Background Color', 'elementor' ),
137 'selectors' => [
138 '{{SELECTOR}}' => 'background-color: {{VALUE}};',
139 ],
140 'condition' => [
141 'background' => [ 'classic', 'gradient', 'video' ],
142 ],
143 ];
144
145 $fields['color_stop'] = [
146 'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ),
147 'type' => Controls_Manager::SLIDER,
148 'size_units' => [ '%', 'custom' ],
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' => esc_html__( 'Second Color', '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' => esc_html_x( 'Location', 'Background Control', 'elementor' ),
173 'type' => Controls_Manager::SLIDER,
174 'size_units' => [ '%', 'custom' ],
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' => esc_html_x( 'Type', 'Background Control', 'elementor' ),
188 'type' => Controls_Manager::SELECT,
189 'options' => [
190 'linear' => esc_html__( 'Linear', 'elementor' ),
191 'radial' => esc_html__( 'Radial', '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' => esc_html__( 'Angle', 'elementor' ),
203 'type' => Controls_Manager::SLIDER,
204 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ],
205 'default' => [
206 'unit' => 'deg',
207 'size' => 180,
208 ],
209 'selectors' => [
210 '{{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}})',
211 ],
212 'condition' => [
213 'background' => [ 'gradient' ],
214 'gradient_type' => 'linear',
215 ],
216 'of_type' => 'gradient',
217 ];
218
219 $fields['gradient_position'] = [
220 'label' => esc_html__( 'Position', 'elementor' ),
221 'type' => Controls_Manager::SELECT,
222 'options' => [
223 'center center' => esc_html__( 'Center Center', 'elementor' ),
224 'center left' => esc_html__( 'Center Left', 'elementor' ),
225 'center right' => esc_html__( 'Center Right', 'elementor' ),
226 'top center' => esc_html__( 'Top Center', 'elementor' ),
227 'top left' => esc_html__( 'Top Left', 'elementor' ),
228 'top right' => esc_html__( 'Top Right', 'elementor' ),
229 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
230 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
231 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
232 ],
233 'default' => 'center center',
234 'selectors' => [
235 '{{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}})',
236 ],
237 'condition' => [
238 'background' => [ 'gradient' ],
239 'gradient_type' => 'radial',
240 ],
241 'of_type' => 'gradient',
242 ];
243
244 $fields['image'] = [
245 'label' => esc_html__( 'Image', 'elementor' ),
246 'type' => Controls_Manager::MEDIA,
247 'ai' => [
248 'category' => 'background',
249 ],
250 'dynamic' => [
251 'active' => true,
252 ],
253 'responsive' => true,
254 'title' => esc_html__( 'Background Image', 'elementor' ),
255 'selectors' => [
256 '{{SELECTOR}}' => 'background-image: url("{{URL}}");',
257 ],
258 'has_sizes' => true,
259 'render_type' => 'template',
260 'condition' => [
261 'background' => [ 'classic' ],
262 ],
263 ];
264
265 $fields['position'] = [
266 'label' => esc_html__( 'Position', 'elementor' ),
267 'type' => Controls_Manager::SELECT,
268 'default' => '',
269 'separator' => 'before',
270 'responsive' => true,
271 'options' => [
272 '' => esc_html__( 'Default', 'elementor' ),
273 'center center' => esc_html__( 'Center Center', 'elementor' ),
274 'center left' => esc_html__( 'Center Left', 'elementor' ),
275 'center right' => esc_html__( 'Center Right', 'elementor' ),
276 'top center' => esc_html__( 'Top Center', 'elementor' ),
277 'top left' => esc_html__( 'Top Left', 'elementor' ),
278 'top right' => esc_html__( 'Top Right', 'elementor' ),
279 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
280 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
281 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
282 'initial' => esc_html__( 'Custom', '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' => esc_html__( 'X Position', 'elementor' ),
296 'type' => Controls_Manager::SLIDER,
297 'responsive' => true,
298 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
299 'default' => [
300 'size' => 0,
301 ],
302 'tablet_default' => [
303 'size' => 0,
304 ],
305 'mobile_default' => [
306 'size' => 0,
307 ],
308 'range' => [
309 'px' => [
310 'min' => -800,
311 'max' => 800,
312 ],
313 'em' => [
314 'min' => -100,
315 'max' => 100,
316 ],
317 '%' => [
318 'min' => -100,
319 'max' => 100,
320 ],
321 'vw' => [
322 'min' => -100,
323 'max' => 100,
324 ],
325 ],
326 'selectors' => [
327 '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
328 ],
329 'condition' => [
330 'background' => [ 'classic' ],
331 'position' => [ 'initial' ],
332 'image[url]!' => '',
333 ],
334 'required' => true,
335 ];
336
337 $fields['ypos'] = [
338 'label' => esc_html__( 'Y Position', 'elementor' ),
339 'type' => Controls_Manager::SLIDER,
340 'responsive' => true,
341 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
342 'default' => [
343 'size' => 0,
344 ],
345 'tablet_default' => [
346 'size' => 0,
347 ],
348 'mobile_default' => [
349 'size' => 0,
350 ],
351 'range' => [
352 'px' => [
353 'min' => -800,
354 'max' => 800,
355 ],
356 'em' => [
357 'min' => -100,
358 'max' => 100,
359 ],
360 '%' => [
361 'min' => -100,
362 'max' => 100,
363 ],
364 'vh' => [
365 'min' => -100,
366 'max' => 100,
367 ],
368 ],
369 'selectors' => [
370 '{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
371 ],
372 'condition' => [
373 'background' => [ 'classic' ],
374 'position' => [ 'initial' ],
375 'image[url]!' => '',
376 ],
377 'required' => true,
378 ];
379
380 $fields['attachment'] = [
381 'label' => esc_html_x( 'Attachment', 'Background Control', 'elementor' ),
382 'type' => Controls_Manager::SELECT,
383 'default' => '',
384 'options' => [
385 '' => esc_html__( 'Default', 'elementor' ),
386 'scroll' => esc_html_x( 'Scroll', 'Background Control', 'elementor' ),
387 'fixed' => esc_html_x( 'Fixed', 'Background Control', 'elementor' ),
388 ],
389 'selectors' => [
390 '(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};',
391 ],
392 'condition' => [
393 'background' => [ 'classic' ],
394 'image[url]!' => '',
395 ],
396 ];
397
398 $fields['attachment_alert'] = [
399 'type' => Controls_Manager::RAW_HTML,
400 'content_classes' => 'elementor-control-field-description',
401 'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ),
402 'separator' => 'none',
403 'condition' => [
404 'background' => [ 'classic' ],
405 'image[url]!' => '',
406 'attachment' => 'fixed',
407 ],
408 ];
409
410 $fields['repeat'] = [
411 'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ),
412 'type' => Controls_Manager::SELECT,
413 'default' => '',
414 'responsive' => true,
415 'options' => [
416 '' => esc_html__( 'Default', 'elementor' ),
417 'no-repeat' => esc_html__( 'No-repeat', 'elementor' ),
418 'repeat' => esc_html__( 'Repeat', 'elementor' ),
419 'repeat-x' => esc_html__( 'Repeat-x', 'elementor' ),
420 'repeat-y' => esc_html__( 'Repeat-y', 'elementor' ),
421 ],
422 'selectors' => [
423 '{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
424 ],
425 'condition' => [
426 'background' => [ 'classic' ],
427 'image[url]!' => '',
428 ],
429 ];
430
431 $fields['size'] = [
432 'label' => esc_html__( 'Display Size', 'elementor' ),
433 'type' => Controls_Manager::SELECT,
434 'responsive' => true,
435 'default' => '',
436 'options' => [
437 '' => esc_html__( 'Default', 'elementor' ),
438 'auto' => esc_html__( 'Auto', 'elementor' ),
439 'cover' => esc_html__( 'Cover', 'elementor' ),
440 'contain' => esc_html__( 'Contain', 'elementor' ),
441 'initial' => esc_html__( 'Custom', 'elementor' ),
442 ],
443 'selectors' => [
444 '{{SELECTOR}}' => 'background-size: {{VALUE}};',
445 ],
446 'condition' => [
447 'background' => [ 'classic' ],
448 'image[url]!' => '',
449 ],
450 ];
451
452 $fields['bg_width'] = [
453 'label' => esc_html__( 'Width', 'elementor' ),
454 'type' => Controls_Manager::SLIDER,
455 'responsive' => true,
456 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
457 'range' => [
458 'px' => [
459 'min' => 0,
460 'max' => 1000,
461 ],
462 '%' => [
463 'min' => 0,
464 'max' => 100,
465 ],
466 'vw' => [
467 'min' => 0,
468 'max' => 100,
469 ],
470 ],
471 'default' => [
472 'size' => 100,
473 'unit' => '%',
474 ],
475 'required' => true,
476 'selectors' => [
477 '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
478
479 ],
480 'condition' => [
481 'background' => [ 'classic' ],
482 'size' => [ 'initial' ],
483 'image[url]!' => '',
484 ],
485 ];
486
487 $fields['video_link'] = [
488 'label' => esc_html__( 'Video Link', 'elementor' ),
489 'type' => Controls_Manager::TEXT,
490 'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E',
491 'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ),
492 'label_block' => true,
493 'default' => '',
494 'dynamic' => [
495 'active' => true,
496 'categories' => [
497 TagsModule::POST_META_CATEGORY,
498 TagsModule::URL_CATEGORY,
499 ],
500 ],
501 'condition' => [
502 'background' => [ 'video' ],
503 ],
504 'of_type' => 'video',
505 'frontend_available' => true,
506 ];
507
508 $fields['video_start'] = [
509 'label' => esc_html__( 'Start Time', 'elementor' ),
510 'type' => Controls_Manager::NUMBER,
511 'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ),
512 'placeholder' => 10,
513 'condition' => [
514 'background' => [ 'video' ],
515 ],
516 'of_type' => 'video',
517 'frontend_available' => true,
518 ];
519
520 $fields['video_end'] = [
521 'label' => esc_html__( 'End Time', 'elementor' ),
522 'type' => Controls_Manager::NUMBER,
523 'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ),
524 'placeholder' => 70,
525 'condition' => [
526 'background' => [ 'video' ],
527 ],
528 'of_type' => 'video',
529 'frontend_available' => true,
530 ];
531
532 $fields['play_once'] = [
533 'label' => esc_html__( 'Play Once', 'elementor' ),
534 'type' => Controls_Manager::SWITCHER,
535 'condition' => [
536 'background' => [ 'video' ],
537 ],
538 'of_type' => 'video',
539 'frontend_available' => true,
540 ];
541
542 $fields['play_on_mobile'] = [
543 'label' => esc_html__( 'Play On Mobile', 'elementor' ),
544 'type' => Controls_Manager::SWITCHER,
545 'condition' => [
546 'background' => [ 'video' ],
547 ],
548 'of_type' => 'video',
549 'frontend_available' => true,
550 ];
551
552 // This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy
553 // Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos
554 // will not run properly. This added control allows users to align all their videos to one host (either
555 // youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not).
556 $fields['privacy_mode'] = [
557 'label' => esc_html__( 'Privacy Mode', 'elementor' ),
558 'type' => Controls_Manager::SWITCHER,
559 'condition' => [
560 'background' => [ 'video' ],
561 ],
562 'of_type' => 'video',
563 'frontend_available' => true,
564 ];
565
566 $fields['video_fallback'] = [
567 'label' => esc_html__( 'Background Fallback', 'elementor' ),
568 'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ),
569 'type' => Controls_Manager::MEDIA,
570 'dynamic' => [
571 'active' => true,
572 ],
573 'condition' => [
574 'background' => [ 'video' ],
575 ],
576 'selectors' => [
577 '{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;',
578 ],
579 'of_type' => 'video',
580 ];
581
582 $fields['slideshow_gallery'] = [
583 'label' => esc_html__( 'Images', 'elementor' ),
584 'type' => Controls_Manager::GALLERY,
585 'condition' => [
586 'background' => [ 'slideshow' ],
587 ],
588 'show_label' => false,
589 'of_type' => 'slideshow',
590 'frontend_available' => true,
591 ];
592
593 $fields['slideshow_loop'] = [
594 'label' => esc_html__( 'Infinite Loop', 'elementor' ),
595 'type' => Controls_Manager::SWITCHER,
596 'default' => 'yes',
597 'condition' => [
598 'background' => [ 'slideshow' ],
599 ],
600 'of_type' => 'slideshow',
601 'frontend_available' => true,
602 ];
603
604 $fields['slideshow_slide_duration'] = [
605 'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)',
606 'type' => Controls_Manager::NUMBER,
607 'default' => 5000,
608 'condition' => [
609 'background' => [ 'slideshow' ],
610 ],
611 'frontend_available' => true,
612 ];
613
614 $fields['slideshow_slide_transition'] = [
615 'label' => esc_html__( 'Transition', 'elementor' ),
616 'type' => Controls_Manager::SELECT,
617 'default' => 'fade',
618 'options' => [
619 'fade' => 'Fade',
620 'slide_right' => 'Slide Right',
621 'slide_left' => 'Slide Left',
622 'slide_up' => 'Slide Up',
623 'slide_down' => 'Slide Down',
624 ],
625 'condition' => [
626 'background' => [ 'slideshow' ],
627 ],
628 'of_type' => 'slideshow',
629 'frontend_available' => true,
630 ];
631
632 $fields['slideshow_transition_duration'] = [
633 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
634 'type' => Controls_Manager::NUMBER,
635 'default' => 500,
636 'condition' => [
637 'background' => [ 'slideshow' ],
638 ],
639 'frontend_available' => true,
640 ];
641
642 $fields['slideshow_background_size'] = [
643 'label' => esc_html__( 'Background Size', 'elementor' ),
644 'type' => Controls_Manager::SELECT,
645 'responsive' => true,
646 'default' => '',
647 'options' => [
648 '' => esc_html__( 'Default', 'elementor' ),
649 'auto' => esc_html__( 'Auto', 'elementor' ),
650 'cover' => esc_html__( 'Cover', 'elementor' ),
651 'contain' => esc_html__( 'Contain', 'elementor' ),
652 ],
653 'selectors' => [
654 '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
655 ],
656 'condition' => [
657 'background' => [ 'slideshow' ],
658 ],
659 ];
660
661 $fields['slideshow_background_position'] = [
662 'label' => esc_html__( 'Background Position', 'elementor' ),
663 'type' => Controls_Manager::SELECT,
664 'default' => '',
665 'responsive' => true,
666 'options' => [
667 '' => esc_html__( 'Default', 'elementor' ),
668 'center center' => esc_html__( 'Center Center', 'elementor' ),
669 'center left' => esc_html__( 'Center Left', 'elementor' ),
670 'center right' => esc_html__( 'Center Right', 'elementor' ),
671 'top center' => esc_html__( 'Top Center', 'elementor' ),
672 'top left' => esc_html__( 'Top Left', 'elementor' ),
673 'top right' => esc_html__( 'Top Right', 'elementor' ),
674 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
675 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
676 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
677 ],
678 'selectors' => [
679 '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
680 ],
681 'condition' => [
682 'background' => [ 'slideshow' ],
683 ],
684 ];
685
686 $fields['slideshow_lazyload'] = [
687 'label' => esc_html__( 'Lazyload', 'elementor' ),
688 'type' => Controls_Manager::SWITCHER,
689 'separator' => 'before',
690 'condition' => [
691 'background' => [ 'slideshow' ],
692 ],
693 'of_type' => 'slideshow',
694 'frontend_available' => true,
695 ];
696
697 $fields['slideshow_ken_burns'] = [
698 'label' => esc_html__( 'Ken Burns Effect', 'elementor' ),
699 'type' => Controls_Manager::SWITCHER,
700 'separator' => 'before',
701 'condition' => [
702 'background' => [ 'slideshow' ],
703 ],
704 'of_type' => 'slideshow',
705 'frontend_available' => true,
706 ];
707
708 $fields['slideshow_ken_burns_zoom_direction'] = [
709 'label' => esc_html__( 'Direction', 'elementor' ),
710 'type' => Controls_Manager::SELECT,
711 'default' => 'in',
712 'options' => [
713 'in' => esc_html__( 'In', 'elementor' ),
714 'out' => esc_html__( 'Out', 'elementor' ),
715 ],
716 'condition' => [
717 'background' => [ 'slideshow' ],
718 'slideshow_ken_burns!' => '',
719 ],
720 'of_type' => 'slideshow',
721 'frontend_available' => true,
722 ];
723
724 return $fields;
725 }
726
727 /**
728 * Get child default args.
729 *
730 * Retrieve the default arguments for all the child controls for a specific group
731 * control.
732 *
733 * @since 1.2.2
734 * @access protected
735 *
736 * @return array Default arguments for all the child controls.
737 */
738 protected function get_child_default_args() {
739 return [
740 'types' => [ 'classic', 'gradient' ],
741 'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer',
742 ];
743 }
744
745 /**
746 * Filter fields.
747 *
748 * Filter which controls to display, using `include`, `exclude`, `condition`
749 * and `of_type` arguments.
750 *
751 * @since 1.2.2
752 * @access protected
753 *
754 * @return array Control fields.
755 */
756 protected function filter_fields() {
757 $fields = parent::filter_fields();
758
759 $args = $this->get_args();
760
761 foreach ( $fields as &$field ) {
762 if ( isset( $field['of_type'] ) && ! in_array( $field['of_type'], $args['types'] ) ) {
763 unset( $field );
764 }
765 }
766
767 return $fields;
768 }
769
770 /**
771 * Prepare fields.
772 *
773 * Process background control fields before adding them to `add_control()`.
774 *
775 * @since 1.2.2
776 * @access protected
777 *
778 * @param array $fields Background control fields.
779 *
780 * @return array Processed fields.
781 */
782 protected function prepare_fields( $fields ) {
783 $args = $this->get_args();
784
785 $background_types = self::get_background_types();
786
787 $choose_types = [];
788
789 foreach ( $args['types'] as $type ) {
790 if ( isset( $background_types[ $type ] ) ) {
791 $choose_types[ $type ] = $background_types[ $type ];
792 }
793 }
794
795 $fields['background']['options'] = $choose_types;
796
797 return parent::prepare_fields( $fields );
798 }
799
800 /**
801 * Get default options.
802 *
803 * Retrieve the default options of the background control. Used to return the
804 * default options while initializing the background control.
805 *
806 * @since 1.9.0
807 * @access protected
808 *
809 * @return array Default background control options.
810 */
811 protected function get_default_options() {
812 return [
813 'popover' => false,
814 ];
815 }
816 }
817