PluginProbe
Elementor Website Builder – more than just a page builder / 3.3.1
Elementor Website Builder – more than just a page builder v3.3.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 / elements / section.php

section.php in Elementor Website Builder – more than just a page builder 3.3.1, at includes/elements/section.php

1,603 lines 37.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 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor section element.
10 *
11 * Elementor section handler class is responsible for initializing the section
12 * element.
13 *
14 * @since 1.0.0
15 */
16 class Element_Section extends Element_Base {
17
18 /**
19 * Section predefined columns presets.
20 *
21 * Holds the predefined columns width for each columns count available by
22 * default by Elementor. Default is an empty array.
23 *
24 * Note that when the user creates a section he can define custom sizes for
25 * the columns. But Elementor sets default values for predefined columns.
26 *
27 * For example two columns 50% width each one, or three columns 33.33% each
28 * one. This property hold the data for those preset values.
29 *
30 * @since 1.0.0
31 * @access private
32 * @static
33 *
34 * @var array Section presets.
35 */
36 private static $presets = [];
37
38 /**
39 * Get element type.
40 *
41 * Retrieve the element type, in this case `section`.
42 *
43 * @since 2.1.0
44 * @access public
45 * @static
46 *
47 * @return string The type.
48 */
49 public static function get_type() {
50 return 'section';
51 }
52
53 /**
54 * Get section name.
55 *
56 * Retrieve the section name.
57 *
58 * @since 1.0.0
59 * @access public
60 *
61 * @return string Section name.
62 */
63 public function get_name() {
64 return 'section';
65 }
66
67 /**
68 * Get section title.
69 *
70 * Retrieve the section title.
71 *
72 * @since 1.0.0
73 * @access public
74 *
75 * @return string Section title.
76 */
77 public function get_title() {
78 return __( 'Section', 'elementor' );
79 }
80
81 /**
82 * Get section icon.
83 *
84 * Retrieve the section icon.
85 *
86 * @since 1.0.0
87 * @access public
88 *
89 * @return string Section icon.
90 */
91 public function get_icon() {
92 return 'eicon-columns';
93 }
94
95 /**
96 * Get presets.
97 *
98 * Retrieve a specific preset columns for a given columns count, or a list
99 * of all the preset if no parameters passed.
100 *
101 * @since 1.0.0
102 * @access public
103 * @static
104 *
105 * @param int $columns_count Optional. Columns count. Default is null.
106 * @param int $preset_index Optional. Preset index. Default is null.
107 *
108 * @return array Section presets.
109 */
110 public static function get_presets( $columns_count = null, $preset_index = null ) {
111 if ( ! self::$presets ) {
112 self::init_presets();
113 }
114
115 $presets = self::$presets;
116
117 if ( null !== $columns_count ) {
118 $presets = $presets[ $columns_count ];
119 }
120
121 if ( null !== $preset_index ) {
122 $presets = $presets[ $preset_index ];
123 }
124
125 return $presets;
126 }
127
128 /**
129 * Initialize presets.
130 *
131 * Initializing the section presets and set the number of columns the
132 * section can have by default. For example a column can have two columns
133 * 50% width each one, or three columns 33.33% each one.
134 *
135 * Note that Elementor sections have default section presets but the user
136 * can set custom number of columns and define custom sizes for each column.
137
138 * @since 1.0.0
139 * @access public
140 * @static
141 */
142 public static function init_presets() {
143 $additional_presets = [
144 2 => [
145 [
146 'preset' => [ 33, 66 ],
147 ],
148 [
149 'preset' => [ 66, 33 ],
150 ],
151 ],
152 3 => [
153 [
154 'preset' => [ 25, 25, 50 ],
155 ],
156 [
157 'preset' => [ 50, 25, 25 ],
158 ],
159 [
160 'preset' => [ 25, 50, 25 ],
161 ],
162 [
163 'preset' => [ 16, 66, 16 ],
164 ],
165 ],
166 ];
167
168 foreach ( range( 1, 10 ) as $columns_count ) {
169 self::$presets[ $columns_count ] = [
170 [
171 'preset' => [],
172 ],
173 ];
174
175 $preset_unit = floor( 1 / $columns_count * 100 );
176
177 for ( $i = 0; $i < $columns_count; $i++ ) {
178 self::$presets[ $columns_count ][0]['preset'][] = $preset_unit;
179 }
180
181 if ( ! empty( $additional_presets[ $columns_count ] ) ) {
182 self::$presets[ $columns_count ] = array_merge( self::$presets[ $columns_count ], $additional_presets[ $columns_count ] );
183 }
184
185 foreach ( self::$presets[ $columns_count ] as $preset_index => & $preset ) {
186 $preset['key'] = $columns_count . $preset_index;
187 }
188 }
189 }
190
191 /**
192 * Get initial config.
193 *
194 * Retrieve the current section initial configuration.
195 *
196 * Adds more configuration on top of the controls list, the tabs assigned to
197 * the control, element name, type, icon and more. This method also adds
198 * section presets.
199 *
200 * @since 2.9.0
201 * @access protected
202 *
203 * @return array The initial config.
204 */
205 protected function get_initial_config() {
206 $config = parent::get_initial_config();
207
208 $config['presets'] = self::get_presets();
209 $config['controls'] = $this->get_controls();
210 $config['tabs_controls'] = $this->get_tabs_controls();
211
212 return $config;
213 }
214
215 /**
216 * Register section controls.
217 *
218 * Used to add new controls to the section element.
219 *
220 * @since 3.1.0
221 * @access protected
222 */
223 protected function register_controls() {
224 $this->start_controls_section(
225 'section_layout',
226 [
227 'label' => __( 'Layout', 'elementor' ),
228 'tab' => Controls_Manager::TAB_LAYOUT,
229 ]
230 );
231
232 // Element Name for the Navigator
233 $this->add_control(
234 '_title',
235 [
236 'label' => __( 'Title', 'elementor' ),
237 'type' => Controls_Manager::HIDDEN,
238 'render_type' => 'none',
239 ]
240 );
241
242 $this->add_control(
243 'layout',
244 [
245 'label' => __( 'Content Width', 'elementor' ),
246 'type' => Controls_Manager::SELECT,
247 'default' => 'boxed',
248 'options' => [
249 'boxed' => __( 'Boxed', 'elementor' ),
250 'full_width' => __( 'Full Width', 'elementor' ),
251 ],
252 'prefix_class' => 'elementor-section-',
253 ]
254 );
255
256 $this->add_responsive_control(
257 'content_width',
258 [
259 'label' => __( 'Width', 'elementor' ),
260 'type' => Controls_Manager::SLIDER,
261 'range' => [
262 'px' => [
263 'min' => 500,
264 'max' => 1600,
265 ],
266 ],
267 'selectors' => [
268 '{{WRAPPER}} > .elementor-container' => 'max-width: {{SIZE}}{{UNIT}};',
269 ],
270 'condition' => [
271 'layout' => [ 'boxed' ],
272 ],
273 'separator' => 'none',
274 ]
275 );
276
277 $this->add_control(
278 'gap',
279 [
280 'label' => __( 'Columns Gap', 'elementor' ),
281 'type' => Controls_Manager::SELECT,
282 'default' => 'default',
283 'options' => [
284 'default' => __( 'Default', 'elementor' ),
285 'no' => __( 'No Gap', 'elementor' ),
286 'narrow' => __( 'Narrow', 'elementor' ),
287 'extended' => __( 'Extended', 'elementor' ),
288 'wide' => __( 'Wide', 'elementor' ),
289 'wider' => __( 'Wider', 'elementor' ),
290 'custom' => __( 'Custom', 'elementor' ),
291 ],
292 ]
293 );
294
295 $this->add_responsive_control(
296 'gap_columns_custom',
297 [
298 'label' => __( 'Custom Columns Gap', 'elementor' ),
299 'type' => Controls_Manager::SLIDER,
300 'range' => [
301 'px' => [
302 'min' => 0,
303 'max' => 500,
304 ],
305 '%' => [
306 'min' => 0,
307 'max' => 100,
308 ],
309 'vh' => [
310 'min' => 0,
311 'max' => 100,
312 ],
313 'vw' => [
314 'min' => 0,
315 'max' => 100,
316 ],
317 ],
318 'size_units' => [ 'px', '%', 'vh', 'vw' ],
319 'selectors' => [
320 '{{WRAPPER}} .elementor-column-gap-custom .elementor-column > .elementor-element-populated' => 'padding: {{SIZE}}{{UNIT}};',
321 ],
322 'condition' => [
323 'gap' => 'custom',
324 ],
325 ]
326 );
327
328 $this->add_control(
329 'height',
330 [
331 'label' => __( 'Height', 'elementor' ),
332 'type' => Controls_Manager::SELECT,
333 'default' => 'default',
334 'options' => [
335 'default' => __( 'Default', 'elementor' ),
336 'full' => __( 'Fit To Screen', 'elementor' ),
337 'min-height' => __( 'Min Height', 'elementor' ),
338 ],
339 'prefix_class' => 'elementor-section-height-',
340 'hide_in_inner' => true,
341 ]
342 );
343
344 $this->add_responsive_control(
345 'custom_height',
346 [
347 'label' => __( 'Minimum Height', 'elementor' ),
348 'type' => Controls_Manager::SLIDER,
349 'default' => [
350 'size' => 400,
351 ],
352 'range' => [
353 'px' => [
354 'min' => 0,
355 'max' => 1440,
356 ],
357 'vh' => [
358 'min' => 0,
359 'max' => 100,
360 ],
361 'vw' => [
362 'min' => 0,
363 'max' => 100,
364 ],
365 ],
366 'size_units' => [ 'px', 'vh', 'vw' ],
367 'selectors' => [
368 '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
369 ],
370 'condition' => [
371 'height' => [ 'min-height' ],
372 ],
373 'hide_in_inner' => true,
374 ]
375 );
376
377 $this->add_control(
378 'height_inner',
379 [
380 'label' => __( 'Height', 'elementor' ),
381 'type' => Controls_Manager::SELECT,
382 'default' => 'default',
383 'options' => [
384 'default' => __( 'Default', 'elementor' ),
385 'full' => __( 'Fit To Screen', 'elementor' ),
386 'min-height' => __( 'Min Height', 'elementor' ),
387 ],
388 'prefix_class' => 'elementor-section-height-',
389 'hide_in_top' => true,
390 ]
391 );
392
393 $this->add_responsive_control(
394 'custom_height_inner',
395 [
396 'label' => __( 'Minimum Height', 'elementor' ),
397 'type' => Controls_Manager::SLIDER,
398 'default' => [
399 'size' => 400,
400 ],
401 'range' => [
402 'px' => [
403 'min' => 0,
404 'max' => 1440,
405 ],
406 ],
407 'selectors' => [
408 '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
409 ],
410 'condition' => [
411 'height_inner' => [ 'min-height' ],
412 ],
413 'size_units' => [ 'px', 'vh', 'vw' ],
414 'hide_in_top' => true,
415 ]
416 );
417
418 $this->add_control(
419 'column_position',
420 [
421 'label' => __( 'Column Position', 'elementor' ),
422 'type' => Controls_Manager::SELECT,
423 'default' => 'middle',
424 'options' => [
425 'stretch' => __( 'Stretch', 'elementor' ),
426 'top' => __( 'Top', 'elementor' ),
427 'middle' => __( 'Middle', 'elementor' ),
428 'bottom' => __( 'Bottom', 'elementor' ),
429 ],
430 'prefix_class' => 'elementor-section-items-',
431 'condition' => [
432 'height' => [ 'full', 'min-height' ],
433 ],
434 ]
435 );
436
437 $content_position_selector = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ?
438 '{{WRAPPER}} > .elementor-container > .elementor-column > .elementor-widget-wrap' :
439 '{{WRAPPER}} > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap > .elementor-widget-wrap';
440
441 $this->add_control(
442 'content_position',
443 [
444 'label' => __( 'Vertical Align', 'elementor' ),
445 'type' => Controls_Manager::SELECT,
446 'default' => '',
447 'options' => [
448 '' => __( 'Default', 'elementor' ),
449 'top' => __( 'Top', 'elementor' ),
450 'middle' => __( 'Middle', 'elementor' ),
451 'bottom' => __( 'Bottom', 'elementor' ),
452 'space-between' => __( 'Space Between', 'elementor' ),
453 'space-around' => __( 'Space Around', 'elementor' ),
454 'space-evenly' => __( 'Space Evenly', 'elementor' ),
455 ],
456 'selectors_dictionary' => [
457 'top' => 'flex-start',
458 'middle' => 'center',
459 'bottom' => 'flex-end',
460 ],
461 'selectors' => [
462 $content_position_selector => 'align-content: {{VALUE}}; align-items: {{VALUE}};',
463 ],
464 // TODO: The following line is for BC since 2.7.0
465 'prefix_class' => 'elementor-section-content-',
466 ]
467 );
468
469 $this->add_control(
470 'overflow',
471 [
472 'label' => __( 'Overflow', 'elementor' ),
473 'type' => Controls_Manager::SELECT,
474 'default' => '',
475 'options' => [
476 '' => __( 'Default', 'elementor' ),
477 'hidden' => __( 'Hidden', 'elementor' ),
478 ],
479 'selectors' => [
480 '{{WRAPPER}}' => 'overflow: {{VALUE}}',
481 ],
482 ]
483 );
484
485 $this->add_control(
486 'stretch_section',
487 [
488 'label' => __( 'Stretch Section', 'elementor' ),
489 'type' => Controls_Manager::SWITCHER,
490 'default' => '',
491 'return_value' => 'section-stretched',
492 'prefix_class' => 'elementor-',
493 'hide_in_inner' => true,
494 'description' => __( 'Stretch the section to the full width of the page using JS.', 'elementor' ) . sprintf( ' <a href="%1$s" target="_blank">%2$s</a>', 'https://go.elementor.com/stretch-section/', __( 'Learn more.', 'elementor' ) ),
495 'render_type' => 'none',
496 'frontend_available' => true,
497 ]
498 );
499
500 $possible_tags = [
501 'div',
502 'header',
503 'footer',
504 'main',
505 'article',
506 'section',
507 'aside',
508 'nav',
509 ];
510
511 $options = [
512 '' => __( 'Default', 'elementor' ),
513 ] + array_combine( $possible_tags, $possible_tags );
514
515 $this->add_control(
516 'html_tag',
517 [
518 'label' => __( 'HTML Tag', 'elementor' ),
519 'type' => Controls_Manager::SELECT,
520 'options' => $options,
521 'separator' => 'before',
522 ]
523 );
524
525 $this->end_controls_section();
526
527 // Section Structure
528 $this->start_controls_section(
529 'section_structure',
530 [
531 'label' => __( 'Structure', 'elementor' ),
532 'tab' => Controls_Manager::TAB_LAYOUT,
533 ]
534 );
535
536 $this->add_control(
537 'structure',
538 [
539 'label' => __( 'Structure', 'elementor' ),
540 'type' => Controls_Manager::STRUCTURE,
541 'default' => '10',
542 'render_type' => 'none',
543 'style_transfer' => false,
544 ]
545 );
546
547 $this->end_controls_section();
548
549 // Section background
550 $this->start_controls_section(
551 'section_background',
552 [
553 'label' => __( 'Background', 'elementor' ),
554 'tab' => Controls_Manager::TAB_STYLE,
555 ]
556 );
557
558 $this->start_controls_tabs( 'tabs_background' );
559
560 $this->start_controls_tab(
561 'tab_background_normal',
562 [
563 'label' => __( 'Normal', 'elementor' ),
564 ]
565 );
566
567 $this->add_group_control(
568 Group_Control_Background::get_type(),
569 [
570 'name' => 'background',
571 'types' => [ 'classic', 'gradient', 'video', 'slideshow' ],
572 'fields_options' => [
573 'background' => [
574 'frontend_available' => true,
575 ],
576 ],
577 ]
578 );
579
580 $this->end_controls_tab();
581
582 $this->start_controls_tab(
583 'tab_background_hover',
584 [
585 'label' => __( 'Hover', 'elementor' ),
586 ]
587 );
588
589 $this->add_group_control(
590 Group_Control_Background::get_type(),
591 [
592 'name' => 'background_hover',
593 'selector' => '{{WRAPPER}}:hover',
594 ]
595 );
596
597 $this->add_control(
598 'background_hover_transition',
599 [
600 'label' => __( 'Transition Duration', 'elementor' ),
601 'type' => Controls_Manager::SLIDER,
602 'default' => [
603 'size' => 0.3,
604 ],
605 'range' => [
606 'px' => [
607 'max' => 3,
608 'step' => 0.1,
609 ],
610 ],
611 'render_type' => 'ui',
612 'separator' => 'before',
613 ]
614 );
615
616 $this->end_controls_tab();
617
618 $this->end_controls_tabs();
619
620 $this->end_controls_section();
621
622 // Background Overlay
623 $this->start_controls_section(
624 'section_background_overlay',
625 [
626 'label' => __( 'Background Overlay', 'elementor' ),
627 'tab' => Controls_Manager::TAB_STYLE,
628 ]
629 );
630
631 $this->start_controls_tabs( 'tabs_background_overlay' );
632
633 $this->start_controls_tab(
634 'tab_background_overlay_normal',
635 [
636 'label' => __( 'Normal', 'elementor' ),
637 ]
638 );
639
640 $this->add_group_control(
641 Group_Control_Background::get_type(),
642 [
643 'name' => 'background_overlay',
644 'selector' => '{{WRAPPER}} > .elementor-background-overlay',
645 ]
646 );
647
648 $this->add_control(
649 'background_overlay_opacity',
650 [
651 'label' => __( 'Opacity', 'elementor' ),
652 'type' => Controls_Manager::SLIDER,
653 'default' => [
654 'size' => .5,
655 ],
656 'range' => [
657 'px' => [
658 'max' => 1,
659 'step' => 0.01,
660 ],
661 ],
662 'selectors' => [
663 '{{WRAPPER}} > .elementor-background-overlay' => 'opacity: {{SIZE}};',
664 ],
665 'condition' => [
666 'background_overlay_background' => [ 'classic', 'gradient' ],
667 ],
668 ]
669 );
670
671 $this->add_group_control(
672 Group_Control_Css_Filter::get_type(),
673 [
674 'name' => 'css_filters',
675 'selector' => '{{WRAPPER}} .elementor-background-overlay',
676 'conditions' => [
677 'relation' => 'or',
678 'terms' => [
679 [
680 'name' => 'background_overlay_image[url]',
681 'operator' => '!==',
682 'value' => '',
683 ],
684 [
685 'name' => 'background_overlay_color',
686 'operator' => '!==',
687 'value' => '',
688 ],
689 ],
690 ],
691 ]
692 );
693
694 $this->add_control(
695 'overlay_blend_mode',
696 [
697 'label' => __( 'Blend Mode', 'elementor' ),
698 'type' => Controls_Manager::SELECT,
699 'options' => [
700 '' => __( 'Normal', 'elementor' ),
701 'multiply' => 'Multiply',
702 'screen' => 'Screen',
703 'overlay' => 'Overlay',
704 'darken' => 'Darken',
705 'lighten' => 'Lighten',
706 'color-dodge' => 'Color Dodge',
707 'saturation' => 'Saturation',
708 'color' => 'Color',
709 'luminosity' => 'Luminosity',
710 ],
711 'selectors' => [
712 '{{WRAPPER}} > .elementor-background-overlay' => 'mix-blend-mode: {{VALUE}}',
713 ],
714 'conditions' => [
715 'relation' => 'or',
716 'terms' => [
717 [
718 'name' => 'background_overlay_image[url]',
719 'operator' => '!==',
720 'value' => '',
721 ],
722 [
723 'name' => 'background_overlay_color',
724 'operator' => '!==',
725 'value' => '',
726 ],
727 ],
728 ],
729 ]
730 );
731
732 $this->end_controls_tab();
733
734 $this->start_controls_tab(
735 'tab_background_overlay_hover',
736 [
737 'label' => __( 'Hover', 'elementor' ),
738 ]
739 );
740
741 $this->add_group_control(
742 Group_Control_Background::get_type(),
743 [
744 'name' => 'background_overlay_hover',
745 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay',
746 ]
747 );
748
749 $this->add_control(
750 'background_overlay_hover_opacity',
751 [
752 'label' => __( 'Opacity', 'elementor' ),
753 'type' => Controls_Manager::SLIDER,
754 'default' => [
755 'size' => .5,
756 ],
757 'range' => [
758 'px' => [
759 'max' => 1,
760 'step' => 0.01,
761 ],
762 ],
763 'selectors' => [
764 '{{WRAPPER}}:hover > .elementor-background-overlay' => 'opacity: {{SIZE}};',
765 ],
766 'condition' => [
767 'background_overlay_hover_background' => [ 'classic', 'gradient' ],
768 ],
769 ]
770 );
771
772 $this->add_group_control(
773 Group_Control_Css_Filter::get_type(),
774 [
775 'name' => 'css_filters_hover',
776 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay',
777 ]
778 );
779
780 $this->add_control(
781 'background_overlay_hover_transition',
782 [
783 'label' => __( 'Transition Duration', 'elementor' ),
784 'type' => Controls_Manager::SLIDER,
785 'default' => [
786 'size' => 0.3,
787 ],
788 'range' => [
789 'px' => [
790 'max' => 3,
791 'step' => 0.1,
792 ],
793 ],
794 'render_type' => 'ui',
795 'separator' => 'before',
796 ]
797 );
798
799 $this->end_controls_tab();
800
801 $this->end_controls_tabs();
802
803 $this->end_controls_section();
804
805 // Section border
806 $this->start_controls_section(
807 'section_border',
808 [
809 'label' => __( 'Border', 'elementor' ),
810 'tab' => Controls_Manager::TAB_STYLE,
811 ]
812 );
813
814 $this->start_controls_tabs( 'tabs_border' );
815
816 $this->start_controls_tab(
817 'tab_border_normal',
818 [
819 'label' => __( 'Normal', 'elementor' ),
820 ]
821 );
822
823 $this->add_group_control(
824 Group_Control_Border::get_type(),
825 [
826 'name' => 'border',
827 ]
828 );
829
830 $this->add_responsive_control(
831 'border_radius',
832 [
833 'label' => __( 'Border Radius', 'elementor' ),
834 'type' => Controls_Manager::DIMENSIONS,
835 'size_units' => [ 'px', '%' ],
836 'selectors' => [
837 '{{WRAPPER}}, {{WRAPPER}} > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
838 ],
839 ]
840 );
841
842 $this->add_group_control(
843 Group_Control_Box_Shadow::get_type(),
844 [
845 'name' => 'box_shadow',
846 ]
847 );
848
849 $this->end_controls_tab();
850
851 $this->start_controls_tab(
852 'tab_border_hover',
853 [
854 'label' => __( 'Hover', 'elementor' ),
855 ]
856 );
857
858 $this->add_group_control(
859 Group_Control_Border::get_type(),
860 [
861 'name' => 'border_hover',
862 'selector' => '{{WRAPPER}}:hover',
863 ]
864 );
865
866 $this->add_responsive_control(
867 'border_radius_hover',
868 [
869 'label' => __( 'Border Radius', 'elementor' ),
870 'type' => Controls_Manager::DIMENSIONS,
871 'size_units' => [ 'px', '%' ],
872 'selectors' => [
873 '{{WRAPPER}}:hover, {{WRAPPER}}:hover > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
874 ],
875 ]
876 );
877
878 $this->add_group_control(
879 Group_Control_Box_Shadow::get_type(),
880 [
881 'name' => 'box_shadow_hover',
882 'selector' => '{{WRAPPER}}:hover',
883 ]
884 );
885
886 $this->add_control(
887 'border_hover_transition',
888 [
889 'label' => __( 'Transition Duration', 'elementor' ),
890 'type' => Controls_Manager::SLIDER,
891 'separator' => 'before',
892 'default' => [
893 'size' => 0.3,
894 ],
895 'range' => [
896 'px' => [
897 'max' => 3,
898 'step' => 0.1,
899 ],
900 ],
901 'conditions' => [
902 'relation' => 'or',
903 'terms' => [
904 [
905 'name' => 'background_background',
906 'operator' => '!==',
907 'value' => '',
908 ],
909 [
910 'name' => 'border_border',
911 'operator' => '!==',
912 'value' => '',
913 ],
914 ],
915 ],
916 'selectors' => [
917 '{{WRAPPER}}' => 'transition: background {{background_hover_transition.SIZE}}s, border {{SIZE}}s, border-radius {{SIZE}}s, box-shadow {{SIZE}}s',
918 '{{WRAPPER}} > .elementor-background-overlay' => 'transition: background {{background_overlay_hover_transition.SIZE}}s, border-radius {{SIZE}}s, opacity {{background_overlay_hover_transition.SIZE}}s',
919 ],
920 ]
921 );
922
923 $this->end_controls_tab();
924
925 $this->end_controls_tabs();
926
927 $this->end_controls_section();
928
929 // Section Shape Divider
930 $this->start_controls_section(
931 'section_shape_divider',
932 [
933 'label' => __( 'Shape Divider', 'elementor' ),
934 'tab' => Controls_Manager::TAB_STYLE,
935 ]
936 );
937
938 $this->start_controls_tabs( 'tabs_shape_dividers' );
939
940 $shapes_options = [
941 '' => __( 'None', 'elementor' ),
942 ];
943
944 foreach ( Shapes::get_shapes() as $shape_name => $shape_props ) {
945 $shapes_options[ $shape_name ] = $shape_props['title'];
946 }
947
948 foreach ( [
949 'top' => __( 'Top', 'elementor' ),
950 'bottom' => __( 'Bottom', 'elementor' ),
951 ] as $side => $side_label ) {
952 $base_control_key = "shape_divider_$side";
953
954 $this->start_controls_tab(
955 "tab_$base_control_key",
956 [
957 'label' => $side_label,
958 ]
959 );
960
961 $this->add_control(
962 $base_control_key,
963 [
964 'label' => __( 'Type', 'elementor' ),
965 'type' => Controls_Manager::SELECT,
966 'options' => $shapes_options,
967 'render_type' => 'none',
968 'frontend_available' => true,
969 ]
970 );
971
972 $this->add_control(
973 $base_control_key . '_color',
974 [
975 'label' => __( 'Color', 'elementor' ),
976 'type' => Controls_Manager::COLOR,
977 'condition' => [
978 "shape_divider_$side!" => '',
979 ],
980 'selectors' => [
981 "{{WRAPPER}} > .elementor-shape-$side .elementor-shape-fill" => 'fill: {{UNIT}};',
982 ],
983 ]
984 );
985
986 $this->add_responsive_control(
987 $base_control_key . '_width',
988 [
989 'label' => __( 'Width', 'elementor' ),
990 'type' => Controls_Manager::SLIDER,
991 'default' => [
992 'unit' => '%',
993 ],
994 'tablet_default' => [
995 'unit' => '%',
996 ],
997 'mobile_default' => [
998 'unit' => '%',
999 ],
1000 'range' => [
1001 '%' => [
1002 'min' => 100,
1003 'max' => 300,
1004 ],
1005 ],
1006 'condition' => [
1007 "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'height_only', Shapes::FILTER_EXCLUDE ) ),
1008 ],
1009 'selectors' => [
1010 "{{WRAPPER}} > .elementor-shape-$side svg" => 'width: calc({{SIZE}}{{UNIT}} + 1.3px)',
1011 ],
1012 ]
1013 );
1014
1015 $this->add_responsive_control(
1016 $base_control_key . '_height',
1017 [
1018 'label' => __( 'Height', 'elementor' ),
1019 'type' => Controls_Manager::SLIDER,
1020 'range' => [
1021 'px' => [
1022 'max' => 500,
1023 ],
1024 ],
1025 'condition' => [
1026 "shape_divider_$side!" => '',
1027 ],
1028 'selectors' => [
1029 "{{WRAPPER}} > .elementor-shape-$side svg" => 'height: {{SIZE}}{{UNIT}};',
1030 ],
1031 ]
1032 );
1033
1034 $this->add_control(
1035 $base_control_key . '_flip',
1036 [
1037 'label' => __( 'Flip', 'elementor' ),
1038 'type' => Controls_Manager::SWITCHER,
1039 'condition' => [
1040 "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_flip' ) ),
1041 ],
1042 'selectors' => [
1043 "{{WRAPPER}} > .elementor-shape-$side svg" => 'transform: translateX(-50%) rotateY(180deg)',
1044 ],
1045 ]
1046 );
1047
1048 $this->add_control(
1049 $base_control_key . '_negative',
1050 [
1051 'label' => __( 'Invert', 'elementor' ),
1052 'type' => Controls_Manager::SWITCHER,
1053 'frontend_available' => true,
1054 'condition' => [
1055 "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_negative' ) ),
1056 ],
1057 'render_type' => 'none',
1058 ]
1059 );
1060
1061 $this->add_control(
1062 $base_control_key . '_above_content',
1063 [
1064 'label' => __( 'Bring to Front', 'elementor' ),
1065 'type' => Controls_Manager::SWITCHER,
1066 'selectors' => [
1067 "{{WRAPPER}} > .elementor-shape-$side" => 'z-index: 2; pointer-events: none',
1068 ],
1069 'condition' => [
1070 "shape_divider_$side!" => '',
1071 ],
1072 ]
1073 );
1074
1075 $this->end_controls_tab();
1076 }
1077
1078 $this->end_controls_tabs();
1079
1080 $this->end_controls_section();
1081
1082 // Section Typography
1083 $this->start_controls_section(
1084 'section_typo',
1085 [
1086 'label' => __( 'Typography', 'elementor' ),
1087 'tab' => Controls_Manager::TAB_STYLE,
1088 ]
1089 );
1090
1091 $this->add_control(
1092 'heading_color',
1093 [
1094 'label' => __( 'Heading Color', 'elementor' ),
1095 'type' => Controls_Manager::COLOR,
1096 'default' => '',
1097 'selectors' => [
1098 '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
1099 ],
1100 'separator' => 'none',
1101 ]
1102 );
1103
1104 $this->add_control(
1105 'color_text',
1106 [
1107 'label' => __( 'Text Color', 'elementor' ),
1108 'type' => Controls_Manager::COLOR,
1109 'default' => '',
1110 'selectors' => [
1111 '{{WRAPPER}}' => 'color: {{VALUE}};',
1112 ],
1113 ]
1114 );
1115
1116 $this->add_control(
1117 'color_link',
1118 [
1119 'label' => __( 'Link Color', 'elementor' ),
1120 'type' => Controls_Manager::COLOR,
1121 'default' => '',
1122 'selectors' => [
1123 '{{WRAPPER}} a' => 'color: {{VALUE}};',
1124 ],
1125 ]
1126 );
1127
1128 $this->add_control(
1129 'color_link_hover',
1130 [
1131 'label' => __( 'Link Hover Color', 'elementor' ),
1132 'type' => Controls_Manager::COLOR,
1133 'default' => '',
1134 'selectors' => [
1135 '{{WRAPPER}} a:hover' => 'color: {{VALUE}};',
1136 ],
1137 ]
1138 );
1139
1140 $this->add_control(
1141 'text_align',
1142 [
1143 'label' => __( 'Text Align', 'elementor' ),
1144 'type' => Controls_Manager::CHOOSE,
1145 'options' => [
1146 'left' => [
1147 'title' => __( 'Left', 'elementor' ),
1148 'icon' => 'eicon-text-align-left',
1149 ],
1150 'center' => [
1151 'title' => __( 'Center', 'elementor' ),
1152 'icon' => 'eicon-text-align-center',
1153 ],
1154 'right' => [
1155 'title' => __( 'Right', 'elementor' ),
1156 'icon' => 'eicon-text-align-right',
1157 ],
1158 ],
1159 'selectors' => [
1160 '{{WRAPPER}} > .elementor-container' => 'text-align: {{VALUE}};',
1161 ],
1162 ]
1163 );
1164
1165 $this->end_controls_section();
1166
1167 // Section Advanced
1168 $this->start_controls_section(
1169 'section_advanced',
1170 [
1171 'label' => __( 'Advanced', 'elementor' ),
1172 'tab' => Controls_Manager::TAB_ADVANCED,
1173 ]
1174 );
1175
1176 $this->add_responsive_control(
1177 'margin',
1178 [
1179 'label' => __( 'Margin', 'elementor' ),
1180 'type' => Controls_Manager::DIMENSIONS,
1181 'size_units' => [ 'px', 'em', '%', 'rem' ],
1182 'allowed_dimensions' => 'vertical',
1183 'placeholder' => [
1184 'top' => '',
1185 'right' => 'auto',
1186 'bottom' => '',
1187 'left' => 'auto',
1188 ],
1189 'selectors' => [
1190 '{{WRAPPER}}' => 'margin-top: {{TOP}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};',
1191 ],
1192 ]
1193 );
1194
1195 $this->add_responsive_control(
1196 'padding',
1197 [
1198 'label' => __( 'Padding', 'elementor' ),
1199 'type' => Controls_Manager::DIMENSIONS,
1200 'size_units' => [ 'px', 'em', '%', 'rem' ],
1201 'selectors' => [
1202 '{{WRAPPER}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1203 ],
1204 ]
1205 );
1206
1207 $this->add_responsive_control(
1208 'z_index',
1209 [
1210 'label' => __( 'Z-Index', 'elementor' ),
1211 'type' => Controls_Manager::NUMBER,
1212 'min' => 0,
1213 'selectors' => [
1214 '{{WRAPPER}}' => 'z-index: {{VALUE}};',
1215 ],
1216 ]
1217 );
1218
1219 $this->add_control(
1220 '_element_id',
1221 [
1222 'label' => __( 'CSS ID', 'elementor' ),
1223 'type' => Controls_Manager::TEXT,
1224 'default' => '',
1225 'dynamic' => [
1226 'active' => true,
1227 ],
1228 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
1229 'style_transfer' => false,
1230 'classes' => 'elementor-control-direction-ltr',
1231 ]
1232 );
1233
1234 $this->add_control(
1235 'css_classes',
1236 [
1237 'label' => __( 'CSS Classes', 'elementor' ),
1238 'type' => Controls_Manager::TEXT,
1239 'default' => '',
1240 'dynamic' => [
1241 'active' => true,
1242 ],
1243 'prefix_class' => '',
1244 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
1245 'classes' => 'elementor-control-direction-ltr',
1246 ]
1247 );
1248
1249 $this->end_controls_section();
1250
1251 $this->start_controls_section(
1252 'section_effects',
1253 [
1254 'label' => __( 'Motion Effects', 'elementor' ),
1255 'tab' => Controls_Manager::TAB_ADVANCED,
1256 ]
1257 );
1258
1259 $this->add_responsive_control(
1260 'animation',
1261 [
1262 'label' => __( 'Entrance Animation', 'elementor' ),
1263 'type' => Controls_Manager::ANIMATION,
1264 'frontend_available' => true,
1265 ]
1266 );
1267
1268 $this->add_control(
1269 'animation_duration',
1270 [
1271 'label' => __( 'Animation Duration', 'elementor' ),
1272 'type' => Controls_Manager::SELECT,
1273 'default' => '',
1274 'options' => [
1275 'slow' => __( 'Slow', 'elementor' ),
1276 '' => __( 'Normal', 'elementor' ),
1277 'fast' => __( 'Fast', 'elementor' ),
1278 ],
1279 'prefix_class' => 'animated-',
1280 'condition' => [
1281 'animation!' => '',
1282 ],
1283 ]
1284 );
1285
1286 $this->add_control(
1287 'animation_delay',
1288 [
1289 'label' => __( 'Animation Delay', 'elementor' ) . ' (ms)',
1290 'type' => Controls_Manager::NUMBER,
1291 'default' => '',
1292 'min' => 0,
1293 'step' => 100,
1294 'condition' => [
1295 'animation!' => '',
1296 ],
1297 'render_type' => 'none',
1298 'frontend_available' => true,
1299 ]
1300 );
1301
1302 $this->end_controls_section();
1303
1304 // Section Responsive
1305 $this->start_controls_section(
1306 '_section_responsive',
1307 [
1308 'label' => __( 'Responsive', 'elementor' ),
1309 'tab' => Controls_Manager::TAB_ADVANCED,
1310 ]
1311 );
1312
1313 $this->add_control(
1314 'reverse_order_tablet',
1315 [
1316 'label' => __( 'Reverse Columns', 'elementor' ) . ' (' . __( 'Tablet', 'elementor' ) . ')',
1317 'type' => Controls_Manager::SWITCHER,
1318 'default' => '',
1319 'prefix_class' => 'elementor-',
1320 'return_value' => 'reverse-tablet',
1321 ]
1322 );
1323
1324 $this->add_control(
1325 'reverse_order_mobile',
1326 [
1327 'label' => __( 'Reverse Columns', 'elementor' ) . ' (' . __( 'Mobile', 'elementor' ) . ')',
1328 'type' => Controls_Manager::SWITCHER,
1329 'default' => '',
1330 'prefix_class' => 'elementor-',
1331 'return_value' => 'reverse-mobile',
1332 ]
1333 );
1334
1335 $this->add_control(
1336 'heading_visibility',
1337 [
1338 'label' => __( 'Visibility', 'elementor' ),
1339 'type' => Controls_Manager::HEADING,
1340 'separator' => 'before',
1341 ]
1342 );
1343
1344 $this->add_control(
1345 'responsive_description',
1346 [
1347 'raw' => __( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ),
1348 'type' => Controls_Manager::RAW_HTML,
1349 'content_classes' => 'elementor-descriptor',
1350 ]
1351 );
1352
1353 $this->add_control(
1354 'hide_desktop',
1355 [
1356 'label' => __( 'Hide On Desktop', 'elementor' ),
1357 'type' => Controls_Manager::SWITCHER,
1358 'default' => '',
1359 'prefix_class' => 'elementor-',
1360 'label_on' => __( 'Hide', 'elementor' ),
1361 'label_off' => __( 'Show', 'elementor' ),
1362 'return_value' => 'hidden-desktop',
1363 ]
1364 );
1365
1366 $this->add_control(
1367 'hide_tablet',
1368 [
1369 'label' => __( 'Hide On Tablet', 'elementor' ),
1370 'type' => Controls_Manager::SWITCHER,
1371 'default' => '',
1372 'prefix_class' => 'elementor-',
1373 'label_on' => __( 'Hide', 'elementor' ),
1374 'label_off' => __( 'Show', 'elementor' ),
1375 'return_value' => 'hidden-tablet',
1376 ]
1377 );
1378
1379 $this->add_control(
1380 'hide_mobile',
1381 [
1382 'label' => __( 'Hide On Mobile', 'elementor' ),
1383 'type' => Controls_Manager::SWITCHER,
1384 'default' => '',
1385 'prefix_class' => 'elementor-',
1386 'label_on' => __( 'Hide', 'elementor' ),
1387 'label_off' => __( 'Show', 'elementor' ),
1388 'return_value' => 'hidden-phone',
1389 ]
1390 );
1391
1392 $this->end_controls_section();
1393
1394 Plugin::$instance->controls_manager->add_custom_attributes_controls( $this );
1395
1396 Plugin::$instance->controls_manager->add_custom_css_controls( $this );
1397 }
1398
1399 /**
1400 * Render section output in the editor.
1401 *
1402 * Used to generate the live preview, using a Backbone JavaScript template.
1403 *
1404 * @since 2.9.0
1405 * @access protected
1406 */
1407 protected function content_template() {
1408 ?>
1409 <#
1410 if ( settings.background_video_link ) {
1411 let videoAttributes = 'autoplay muted playsinline';
1412
1413 if ( ! settings.background_play_once ) {
1414 videoAttributes += ' loop';
1415 }
1416
1417 view.addRenderAttribute( 'background-video-container', 'class', 'elementor-background-video-container' );
1418
1419 if ( ! settings.background_play_on_mobile ) {
1420 view.addRenderAttribute( 'background-video-container', 'class', 'elementor-hidden-phone' );
1421 }
1422 #>
1423 <div {{{ view.getRenderAttributeString( 'background-video-container' ) }}}>
1424 <div class="elementor-background-video-embed"></div>
1425 <video class="elementor-background-video-hosted elementor-html5-video" {{ videoAttributes }}></video>
1426 </div>
1427 <# } #>
1428 <div class="elementor-background-overlay"></div>
1429 <div class="elementor-shape elementor-shape-top"></div>
1430 <div class="elementor-shape elementor-shape-bottom"></div>
1431 <div class="elementor-container elementor-column-gap-{{ settings.gap }}">
1432 <?php if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?>
1433 <div class="elementor-row"></div>
1434 <?php } ?>
1435 </div>
1436 <?php
1437 }
1438
1439 /**
1440 * Before section rendering.
1441 *
1442 * Used to add stuff before the section element.
1443 *
1444 * @since 1.0.0
1445 * @access public
1446 */
1447 public function before_render() {
1448 $settings = $this->get_settings_for_display();
1449 ?>
1450 <<?php echo $this->get_html_tag(); ?> <?php $this->print_render_attribute_string( '_wrapper' ); ?>>
1451 <?php
1452 if ( 'video' === $settings['background_background'] ) :
1453 if ( $settings['background_video_link'] ) :
1454 $video_properties = Embed::get_video_properties( $settings['background_video_link'] );
1455
1456 $this->add_render_attribute( 'background-video-container', 'class', 'elementor-background-video-container' );
1457
1458 if ( ! $settings['background_play_on_mobile'] ) {
1459 $this->add_render_attribute( 'background-video-container', 'class', 'elementor-hidden-phone' );
1460 }
1461 ?>
1462 <div <?php echo $this->get_render_attribute_string( 'background-video-container' ); ?>>
1463 <?php if ( $video_properties ) : ?>
1464 <div class="elementor-background-video-embed"></div>
1465 <?php
1466 else :
1467 $video_tag_attributes = 'autoplay muted playsinline';
1468 if ( 'yes' !== $settings['background_play_once'] ) :
1469 $video_tag_attributes .= ' loop';
1470 endif;
1471 ?>
1472 <video class="elementor-background-video-hosted elementor-html5-video" <?php echo $video_tag_attributes; ?>></video>
1473 <?php endif; ?>
1474 </div>
1475 <?php
1476 endif;
1477 endif;
1478
1479 $has_background_overlay = in_array( $settings['background_overlay_background'], [ 'classic', 'gradient' ], true ) ||
1480 in_array( $settings['background_overlay_hover_background'], [ 'classic', 'gradient' ], true );
1481
1482 if ( $has_background_overlay ) :
1483 ?>
1484 <div class="elementor-background-overlay"></div>
1485 <?php
1486 endif;
1487
1488 if ( $settings['shape_divider_top'] ) {
1489 $this->print_shape_divider( 'top' );
1490 }
1491
1492 if ( $settings['shape_divider_bottom'] ) {
1493 $this->print_shape_divider( 'bottom' );
1494 }
1495 ?>
1496 <div class="elementor-container elementor-column-gap-<?php echo esc_attr( $settings['gap'] ); ?>">
1497 <?php if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?>
1498 <div class="elementor-row">
1499 <?php }
1500 }
1501
1502 /**
1503 * After section rendering.
1504 *
1505 * Used to add stuff after the section element.
1506 *
1507 * @since 1.0.0
1508 * @access public
1509 */
1510 public function after_render() {
1511 ?>
1512 <?php if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?>
1513 </div>
1514 <?php } ?>
1515 </div>
1516 </<?php echo $this->get_html_tag(); ?>>
1517 <?php
1518 }
1519
1520 /**
1521 * Add section render attributes.
1522 *
1523 * Used to add attributes to the current section wrapper HTML tag.
1524 *
1525 * @since 1.3.0
1526 * @access protected
1527 */
1528 protected function add_render_attributes() {
1529
1530 $section_type = $this->get_data( 'isInner' ) ? 'inner' : 'top';
1531
1532 $this->add_render_attribute(
1533 '_wrapper', 'class', [
1534 'elementor-section',
1535 'elementor-' . $section_type . '-section',
1536 ]
1537 );
1538
1539 parent::add_render_attributes();
1540 }
1541
1542 /**
1543 * Get default child type.
1544 *
1545 * Retrieve the section child type based on element data.
1546 *
1547 * @since 1.0.0
1548 * @access protected
1549 *
1550 * @param array $element_data Element ID.
1551 *
1552 * @return Element_Base Section default child type.
1553 */
1554 protected function _get_default_child_type( array $element_data ) {
1555 return Plugin::$instance->elements_manager->get_element_types( 'column' );
1556 }
1557
1558 /**
1559 * Get HTML tag.
1560 *
1561 * Retrieve the section element HTML tag.
1562 *
1563 * @since 1.5.3
1564 * @access private
1565 *
1566 * @return string Section HTML tag.
1567 */
1568 private function get_html_tag() {
1569 $html_tag = $this->get_settings( 'html_tag' );
1570
1571 if ( empty( $html_tag ) ) {
1572 $html_tag = 'section';
1573 }
1574
1575 return Utils::validate_html_tag( $html_tag );
1576 }
1577
1578 /**
1579 * Print section shape divider.
1580 *
1581 * Used to generate the shape dividers HTML.
1582 *
1583 * @since 1.3.0
1584 * @access private
1585 *
1586 * @param string $side Shape divider side, used to set the shape key.
1587 */
1588 private function print_shape_divider( $side ) {
1589 $settings = $this->get_active_settings();
1590 $base_setting_key = "shape_divider_$side";
1591 $negative = ! empty( $settings[ $base_setting_key . '_negative' ] );
1592 $shape_path = Shapes::get_shape_path( $settings[ $base_setting_key ], $negative );
1593 if ( ! is_file( $shape_path ) || ! is_readable( $shape_path ) ) {
1594 return;
1595 }
1596 ?>
1597 <div class="elementor-shape elementor-shape-<?php echo esc_attr( $side ); ?>" data-negative="<?php echo var_export( $negative ); ?>">
1598 <?php echo file_get_contents( $shape_path ); ?>
1599 </div>
1600 <?php
1601 }
1602 }
1603