Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/includes/controls/groups/background.php

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