PluginProbe
Elementor Website Builder – more than just a page builder / 3.11.5
Elementor Website Builder – more than just a page builder v3.11.5
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 / column.php

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

1,083 lines 28.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
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10 /**
11 * Elementor column element.
12 *
13 * Elementor column handler class is responsible for initializing the column
14 * element.
15 *
16 * @since 1.0.0
17 */
18 class Element_Column extends Element_Base {
19
20 /**
21 * Get column name.
22 *
23 * Retrieve the column name.
24 *
25 * @since 1.0.0
26 * @access public
27 *
28 * @return string Column name.
29 */
30 public function get_name() {
31 return 'column';
32 }
33
34 /**
35 * Get element type.
36 *
37 * Retrieve the element type, in this case `column`.
38 *
39 * @since 2.1.0
40 * @access public
41 * @static
42 *
43 * @return string The type.
44 */
45 public static function get_type() {
46 return 'column';
47 }
48
49 /**
50 * Get column title.
51 *
52 * Retrieve the column title.
53 *
54 * @since 1.0.0
55 * @access public
56 *
57 * @return string Column title.
58 */
59 public function get_title() {
60 return esc_html__( 'Column', 'elementor' );
61 }
62
63 /**
64 * Get column icon.
65 *
66 * Retrieve the column icon.
67 *
68 * @since 1.0.0
69 * @access public
70 *
71 * @return string Column icon.
72 */
73 public function get_icon() {
74 return 'eicon-column';
75 }
76
77 /**
78 * Get initial config.
79 *
80 * Retrieve the current section initial configuration.
81 *
82 * Adds more configuration on top of the controls list, the tabs assigned to
83 * the control, element name, type, icon and more. This method also adds
84 * section presets.
85 *
86 * @since 2.9.0
87 * @access protected
88 *
89 * @return array The initial config.
90 */
91 protected function get_initial_config() {
92 $config = parent::get_initial_config();
93
94 $config['controls'] = $this->get_controls();
95 $config['tabs_controls'] = $this->get_tabs_controls();
96
97 return $config;
98 }
99
100 /**
101 * Register column controls.
102 *
103 * Used to add new controls to the column element.
104 *
105 * @since 3.1.0
106 * @access protected
107 */
108 protected function register_controls() {
109 // Section Layout.
110 $this->start_controls_section(
111 'layout',
112 [
113 'label' => esc_html__( 'Layout', 'elementor' ),
114 'tab' => Controls_Manager::TAB_LAYOUT,
115 ]
116 );
117
118 // Element Name for the Navigator
119 $this->add_control(
120 '_title',
121 [
122 'label' => esc_html__( 'Title', 'elementor' ),
123 'type' => Controls_Manager::HIDDEN,
124 'render_type' => 'none',
125 ]
126 );
127
128 $active_breakpoint_keys = array_reverse( array_keys( Plugin::$instance->breakpoints->get_active_breakpoints() ) );
129 $inline_size_device_args = [
130 Breakpoints_Manager::BREAKPOINT_KEY_MOBILE => [ 'placeholder' => 100 ],
131 ];
132
133 foreach ( $active_breakpoint_keys as $breakpoint_key ) {
134 if ( ! isset( $inline_size_device_args[ $breakpoint_key ] ) ) {
135 $inline_size_device_args[ $breakpoint_key ] = [];
136 }
137
138 $inline_size_device_args[ $breakpoint_key ] = array_merge_recursive(
139 $inline_size_device_args[ $breakpoint_key ],
140 [
141 'max' => 100,
142 'required' => false,
143 ]
144 );
145 }
146
147 if ( in_array( Breakpoints_Manager::BREAKPOINT_KEY_MOBILE_EXTRA, $active_breakpoint_keys, true ) ) {
148 $min_affected_device_value = Breakpoints_Manager::BREAKPOINT_KEY_MOBILE_EXTRA;
149 } else {
150 $min_affected_device_value = Breakpoints_Manager::BREAKPOINT_KEY_TABLET;
151 }
152
153 $this->add_responsive_control(
154 '_inline_size',
155 [
156 'label' => esc_html__( 'Column Width', 'elementor' ) . ' (%)',
157 'type' => Controls_Manager::NUMBER,
158 'min' => 2,
159 'max' => 98,
160 'required' => true,
161 'device_args' => $inline_size_device_args,
162 'min_affected_device' => [
163 Breakpoints_Manager::BREAKPOINT_KEY_DESKTOP => $min_affected_device_value,
164 Breakpoints_Manager::BREAKPOINT_KEY_LAPTOP => $min_affected_device_value,
165 Breakpoints_Manager::BREAKPOINT_KEY_TABLET_EXTRA => $min_affected_device_value,
166 Breakpoints_Manager::BREAKPOINT_KEY_TABLET => $min_affected_device_value,
167 Breakpoints_Manager::BREAKPOINT_KEY_MOBILE_EXTRA => $min_affected_device_value,
168 ],
169 'selectors' => [
170 '{{WRAPPER}}' => 'width: {{VALUE}}%',
171 ],
172 ]
173 );
174
175 $is_dome_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
176 $main_selector_element = $is_dome_optimization_active ? 'widget' : 'column';
177 $widget_wrap_child = $is_dome_optimization_active ? '' : ' > .elementor-widget-wrap';
178 $column_wrap_child = $is_dome_optimization_active ? '' : ' > .elementor-column-wrap';
179
180 $this->add_responsive_control(
181 'content_position',
182 [
183 'label' => esc_html__( 'Vertical Align', 'elementor' ),
184 'type' => Controls_Manager::SELECT,
185 'default' => '',
186 'options' => [
187 '' => esc_html__( 'Default', 'elementor' ),
188 'top' => esc_html__( 'Top', 'elementor' ),
189 'center' => esc_html__( 'Middle', 'elementor' ),
190 'bottom' => esc_html__( 'Bottom', 'elementor' ),
191 'space-between' => esc_html__( 'Space Between', 'elementor' ),
192 'space-around' => esc_html__( 'Space Around', 'elementor' ),
193 'space-evenly' => esc_html__( 'Space Evenly', 'elementor' ),
194 ],
195 'selectors_dictionary' => [
196 'top' => 'flex-start',
197 'bottom' => 'flex-end',
198 ],
199 'selectors' => [
200 // TODO: The following line is for BC since 2.7.0
201 '.elementor-bc-flex-widget {{WRAPPER}}.elementor-column .elementor-' . $main_selector_element . '-wrap' => 'align-items: {{VALUE}}',
202 // This specificity is intended to make sure column css overwrites section css on vertical alignment (content_position)
203 '{{WRAPPER}}.elementor-column.elementor-element[data-element_type="column"] > .elementor-' . $main_selector_element . '-wrap.elementor-element-populated' . $widget_wrap_child => 'align-content: {{VALUE}}; align-items: {{VALUE}};',
204 ],
205 ]
206 );
207
208 $this->add_responsive_control(
209 'align',
210 [
211 'label' => esc_html__( 'Horizontal Align', 'elementor' ),
212 'type' => Controls_Manager::SELECT,
213 'default' => '',
214 'options' => [
215 '' => esc_html__( 'Default', 'elementor' ),
216 'flex-start' => esc_html__( 'Start', 'elementor' ),
217 'center' => esc_html__( 'Center', 'elementor' ),
218 'flex-end' => esc_html__( 'End', 'elementor' ),
219 'space-between' => esc_html__( 'Space Between', 'elementor' ),
220 'space-around' => esc_html__( 'Space Around', 'elementor' ),
221 'space-evenly' => esc_html__( 'Space Evenly', 'elementor' ),
222 ],
223 'selectors' => [
224 '{{WRAPPER}}.elementor-column' . $column_wrap_child . ' > .elementor-widget-wrap' => 'justify-content: {{VALUE}}',
225 ],
226 ]
227 );
228
229 $space_between_widgets_selector = $is_dome_optimization_active ? '' : '> .elementor-column-wrap ';
230
231 $this->add_responsive_control(
232 'space_between_widgets',
233 [
234 'label' => esc_html__( 'Widgets Space', 'elementor' ) . ' (px)',
235 'type' => Controls_Manager::NUMBER,
236 'placeholder' => 20,
237 'selectors' => [
238 '{{WRAPPER}} ' . $space_between_widgets_selector . '> .elementor-widget-wrap > .elementor-widget:not(.elementor-widget__width-auto):not(.elementor-widget__width-initial):not(:last-child):not(.elementor-absolute)' => 'margin-bottom: {{VALUE}}px', //Need the full path for exclude the inner section
239 ],
240 ]
241 );
242
243 $possible_tags = [
244 'div',
245 'header',
246 'footer',
247 'main',
248 'article',
249 'section',
250 'aside',
251 'nav',
252 ];
253
254 $options = [
255 '' => esc_html__( 'Default', 'elementor' ),
256 ] + array_combine( $possible_tags, $possible_tags );
257
258 $this->add_control(
259 'html_tag',
260 [
261 'label' => esc_html__( 'HTML Tag', 'elementor' ),
262 'type' => Controls_Manager::SELECT,
263 'options' => $options,
264 'render_type' => 'none',
265 ]
266 );
267
268 $this->end_controls_section();
269
270 $this->start_controls_section(
271 'section_style',
272 [
273 'label' => esc_html__( 'Background', 'elementor' ),
274 'tab' => Controls_Manager::TAB_STYLE,
275 ]
276 );
277
278 $this->start_controls_tabs( 'tabs_background' );
279
280 $this->start_controls_tab(
281 'tab_background_normal',
282 [
283 'label' => esc_html__( 'Normal', 'elementor' ),
284 ]
285 );
286
287 $this->add_group_control(
288 Group_Control_Background::get_type(),
289 [
290 'name' => 'background',
291 'types' => [ 'classic', 'gradient', 'slideshow' ],
292 'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background) > .elementor-' . $main_selector_element . '-wrap, {{WRAPPER}} > .elementor-' . $main_selector_element . '-wrap > .elementor-motion-effects-container > .elementor-motion-effects-layer',
293 'fields_options' => [
294 'background' => [
295 'frontend_available' => true,
296 ],
297 'image' => [
298 'background_lazyload' => [
299 'active' => true,
300 'keys' => [ 'background_image', 'url' ],
301 'selector' => '.elementor-element-populated',
302 ],
303 ],
304 ],
305 ]
306 );
307
308 $this->end_controls_tab();
309
310 $this->start_controls_tab(
311 'tab_background_hover',
312 [
313 'label' => esc_html__( 'Hover', 'elementor' ),
314 ]
315 );
316
317 $this->add_group_control(
318 Group_Control_Background::get_type(),
319 [
320 'name' => 'background_hover',
321 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
322 ]
323 );
324
325 $this->add_control(
326 'background_hover_transition',
327 [
328 'label' => esc_html__( 'Transition Duration', 'elementor' ),
329 'type' => Controls_Manager::SLIDER,
330 'default' => [
331 'size' => 0.3,
332 ],
333 'range' => [
334 'px' => [
335 'max' => 3,
336 'step' => 0.1,
337 ],
338 ],
339 'render_type' => 'ui',
340 'separator' => 'before',
341 ]
342 );
343
344 $this->end_controls_tab();
345
346 $this->end_controls_tabs();
347
348 $this->end_controls_section();
349
350 // Section Column Background Overlay.
351 $this->start_controls_section(
352 'section_background_overlay',
353 [
354 'label' => esc_html__( 'Background Overlay', 'elementor' ),
355 'tab' => Controls_Manager::TAB_STYLE,
356 'condition' => [
357 'background_background' => [ 'classic', 'gradient' ],
358 ],
359 ]
360 );
361
362 $this->start_controls_tabs( 'tabs_background_overlay' );
363
364 $this->start_controls_tab(
365 'tab_background_overlay_normal',
366 [
367 'label' => esc_html__( 'Normal', 'elementor' ),
368 ]
369 );
370
371 $this->add_group_control(
372 Group_Control_Background::get_type(),
373 [
374 'name' => 'background_overlay',
375 'selector' => '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay',
376 'fields_options' => [
377 'image' => [
378 'background_lazyload' => [
379 'active' => true,
380 'keys' => [ '_background_overlay', 'url' ],
381 'selector' => '.elementor-background-overlay,',
382 ],
383 ],
384 ],
385 ]
386 );
387
388 $this->add_responsive_control(
389 'background_overlay_opacity',
390 [
391 'label' => esc_html__( 'Opacity', 'elementor' ),
392 'type' => Controls_Manager::SLIDER,
393 'default' => [
394 'size' => .5,
395 ],
396 'range' => [
397 'px' => [
398 'max' => 1,
399 'step' => 0.01,
400 ],
401 ],
402 'selectors' => [
403 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'opacity: {{SIZE}};',
404 ],
405 'condition' => [
406 'background_overlay_background' => [ 'classic', 'gradient' ],
407 ],
408 ]
409 );
410
411 $this->add_group_control(
412 Group_Control_Css_Filter::get_type(),
413 [
414 'name' => 'css_filters',
415 'selector' => '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay',
416 ]
417 );
418
419 $this->add_control(
420 'overlay_blend_mode',
421 [
422 'label' => esc_html__( 'Blend Mode', 'elementor' ),
423 'type' => Controls_Manager::SELECT,
424 'options' => [
425 '' => esc_html__( 'Normal', 'elementor' ),
426 'multiply' => esc_html__( 'Multiply', 'elementor' ),
427 'screen' => esc_html__( 'Screen', 'elementor' ),
428 'overlay' => esc_html__( 'Overlay', 'elementor' ),
429 'darken' => esc_html__( 'Darken', 'elementor' ),
430 'lighten' => esc_html__( 'Lighten', 'elementor' ),
431 'color-dodge' => esc_html__( 'Color Dodge', 'elementor' ),
432 'saturation' => esc_html__( 'Saturation', 'elementor' ),
433 'color' => esc_html__( 'Color', 'elementor' ),
434 'difference' => esc_html__( 'Difference', 'elementor' ),
435 'exclusion' => esc_html__( 'Exclusion', 'elementor' ),
436 'hue' => esc_html__( 'Hue', 'elementor' ),
437 'luminosity' => esc_html__( 'Luminosity', 'elementor' ),
438 ],
439 'selectors' => [
440 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'mix-blend-mode: {{VALUE}}',
441 ],
442 ]
443 );
444
445 $this->end_controls_tab();
446
447 $this->start_controls_tab(
448 'tab_background_overlay_hover',
449 [
450 'label' => esc_html__( 'Hover', 'elementor' ),
451 ]
452 );
453
454 $this->add_group_control(
455 Group_Control_Background::get_type(),
456 [
457 'name' => 'background_overlay_hover',
458 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay',
459 ]
460 );
461
462 $this->add_responsive_control(
463 'background_overlay_hover_opacity',
464 [
465 'label' => esc_html__( 'Opacity', 'elementor' ),
466 'type' => Controls_Manager::SLIDER,
467 'default' => [
468 'size' => .5,
469 ],
470 'range' => [
471 'px' => [
472 'max' => 1,
473 'step' => 0.01,
474 ],
475 ],
476 'selectors' => [
477 '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay' => 'opacity: {{SIZE}};',
478 ],
479 'condition' => [
480 'background_overlay_hover_background' => [ 'classic', 'gradient' ],
481 ],
482 ]
483 );
484
485 $this->add_group_control(
486 Group_Control_Css_Filter::get_type(),
487 [
488 'name' => 'css_filters_hover',
489 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay',
490 ]
491 );
492
493 $this->add_control(
494 'background_overlay_hover_transition',
495 [
496 'label' => esc_html__( 'Transition Duration', 'elementor' ),
497 'type' => Controls_Manager::SLIDER,
498 'default' => [
499 'size' => 0.3,
500 ],
501 'range' => [
502 'px' => [
503 'max' => 3,
504 'step' => 0.1,
505 ],
506 ],
507 'render_type' => 'ui',
508 'separator' => 'before',
509 ]
510 );
511
512 $this->end_controls_tab();
513
514 $this->end_controls_tabs();
515
516 $this->end_controls_section();
517
518 $this->start_controls_section(
519 'section_border',
520 [
521 'label' => esc_html__( 'Border', 'elementor' ),
522 'tab' => Controls_Manager::TAB_STYLE,
523 ]
524 );
525
526 $this->start_controls_tabs( 'tabs_border' );
527
528 $this->start_controls_tab(
529 'tab_border_normal',
530 [
531 'label' => esc_html__( 'Normal', 'elementor' ),
532 ]
533 );
534
535 $this->add_group_control(
536 Group_Control_Border::get_type(),
537 [
538 'name' => 'border',
539 'selector' => '{{WRAPPER}} > .elementor-element-populated',
540 ]
541 );
542
543 $this->add_responsive_control(
544 'border_radius',
545 [
546 'label' => esc_html__( 'Border Radius', 'elementor' ),
547 'type' => Controls_Manager::DIMENSIONS,
548 'size_units' => [ 'px', '%', 'em', 'custom' ],
549 'selectors' => [
550 '{{WRAPPER}} > .elementor-element-populated, {{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay, {{WRAPPER}} > .elementor-background-slideshow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
551 ],
552 ]
553 );
554
555 $this->add_group_control(
556 Group_Control_Box_Shadow::get_type(),
557 [
558 'name' => 'box_shadow',
559 'selector' => '{{WRAPPER}} > .elementor-element-populated',
560 ]
561 );
562
563 $this->end_controls_tab();
564
565 $this->start_controls_tab(
566 'tab_border_hover',
567 [
568 'label' => esc_html__( 'Hover', 'elementor' ),
569 ]
570 );
571
572 $this->add_group_control(
573 Group_Control_Border::get_type(),
574 [
575 'name' => 'border_hover',
576 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
577 ]
578 );
579
580 $this->add_responsive_control(
581 'border_radius_hover',
582 [
583 'label' => esc_html__( 'Border Radius', 'elementor' ),
584 'type' => Controls_Manager::DIMENSIONS,
585 'size_units' => [ 'px', '%', 'em', 'custom' ],
586 'selectors' => [
587 '{{WRAPPER}}:hover > .elementor-element-populated, {{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
588 ],
589 ]
590 );
591
592 $this->add_group_control(
593 Group_Control_Box_Shadow::get_type(),
594 [
595 'name' => 'box_shadow_hover',
596 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
597 ]
598 );
599
600 $this->add_control(
601 'border_hover_transition',
602 [
603 'label' => esc_html__( 'Transition Duration', 'elementor' ),
604 'type' => Controls_Manager::SLIDER,
605 'separator' => 'before',
606 'default' => [
607 'size' => 0.3,
608 ],
609 'range' => [
610 'px' => [
611 'max' => 3,
612 'step' => 0.1,
613 ],
614 ],
615 'conditions' => [
616 'relation' => 'or',
617 'terms' => [
618 [
619 'name' => 'background_background',
620 'operator' => '!==',
621 'value' => '',
622 ],
623 [
624 'name' => 'border_border',
625 'operator' => '!==',
626 'value' => '',
627 ],
628 ],
629 ],
630 'selectors' => [
631 '{{WRAPPER}} > .elementor-element-populated' => 'transition: background {{background_hover_transition.SIZE}}s, border {{SIZE}}s, border-radius {{SIZE}}s, box-shadow {{SIZE}}s',
632 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'transition: background {{background_overlay_hover_transition.SIZE}}s, border-radius {{SIZE}}s, opacity {{background_overlay_hover_transition.SIZE}}s',
633 ],
634 ]
635 );
636
637 $this->end_controls_tab();
638
639 $this->end_controls_tabs();
640
641 $this->end_controls_section();
642
643 // Section Typography.
644 $this->start_controls_section(
645 'section_typo',
646 [
647 'label' => esc_html__( 'Typography', 'elementor' ),
648 'type' => Controls_Manager::SECTION,
649 'tab' => Controls_Manager::TAB_STYLE,
650 ]
651 );
652
653 $this->add_control(
654 'heading_color',
655 [
656 'label' => esc_html__( 'Heading Color', 'elementor' ),
657 'type' => Controls_Manager::COLOR,
658 'default' => '',
659 'selectors' => [
660 '{{WRAPPER}} .elementor-element-populated .elementor-heading-title' => 'color: {{VALUE}};',
661 ],
662 'separator' => 'none',
663 ]
664 );
665
666 $this->add_control(
667 'color_text',
668 [
669 'label' => esc_html__( 'Text Color', 'elementor' ),
670 'type' => Controls_Manager::COLOR,
671 'default' => '',
672 'selectors' => [
673 '{{WRAPPER}} > .elementor-element-populated' => 'color: {{VALUE}};',
674 ],
675 ]
676 );
677
678 $this->add_control(
679 'color_link',
680 [
681 'label' => esc_html__( 'Link Color', 'elementor' ),
682 'type' => Controls_Manager::COLOR,
683 'default' => '',
684 'selectors' => [
685 '{{WRAPPER}} .elementor-element-populated a' => 'color: {{VALUE}};',
686 ],
687 ]
688 );
689
690 $this->add_control(
691 'color_link_hover',
692 [
693 'label' => esc_html__( 'Link Hover Color', 'elementor' ),
694 'type' => Controls_Manager::COLOR,
695 'default' => '',
696 'selectors' => [
697 '{{WRAPPER}} .elementor-element-populated a:hover' => 'color: {{VALUE}};',
698 ],
699 ]
700 );
701
702 $this->add_responsive_control(
703 'text_align',
704 [
705 'label' => esc_html__( 'Text Align', 'elementor' ),
706 'type' => Controls_Manager::CHOOSE,
707 'options' => [
708 'left' => [
709 'title' => esc_html__( 'Left', 'elementor' ),
710 'icon' => 'eicon-text-align-left',
711 ],
712 'center' => [
713 'title' => esc_html__( 'Center', 'elementor' ),
714 'icon' => 'eicon-text-align-center',
715 ],
716 'right' => [
717 'title' => esc_html__( 'Right', 'elementor' ),
718 'icon' => 'eicon-text-align-right',
719 ],
720 'justify' => [
721 'title' => esc_html__( 'Justified', 'elementor' ),
722 'icon' => 'eicon-text-align-justify',
723 ],
724 ],
725 'selectors' => [
726 '{{WRAPPER}} > .elementor-element-populated' => 'text-align: {{VALUE}};',
727 ],
728 ]
729 );
730
731 $this->end_controls_section();
732
733 // Section Advanced.
734 $this->start_controls_section(
735 'section_advanced',
736 [
737 'label' => esc_html__( 'Advanced', 'elementor' ),
738 'type' => Controls_Manager::SECTION,
739 'tab' => Controls_Manager::TAB_ADVANCED,
740 ]
741 );
742
743 $this->add_responsive_control(
744 'margin',
745 [
746 'label' => esc_html__( 'Margin', 'elementor' ),
747 'type' => Controls_Manager::DIMENSIONS,
748 'size_units' => [ 'px', 'em', '%', 'rem', 'custom' ],
749 'selectors' => [
750 '{{WRAPPER}} > .elementor-element-populated' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};
751 --e-column-margin-right: {{RIGHT}}{{UNIT}}; --e-column-margin-left: {{LEFT}}{{UNIT}};',
752 ],
753 ]
754 );
755
756 $padding_selector = '{{WRAPPER}} > .elementor-element-populated';
757
758 if ( ! $is_dome_optimization_active ) {
759 $padding_selector .= ' > .elementor-widget-wrap';
760 }
761
762 $this->add_responsive_control(
763 'padding',
764 [
765 'label' => esc_html__( 'Padding', 'elementor' ),
766 'type' => Controls_Manager::DIMENSIONS,
767 'size_units' => [ 'px', 'em', '%', 'rem', 'custom' ],
768 'selectors' => [
769 $padding_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
770 ],
771 ]
772 );
773
774 $this->add_responsive_control(
775 'z_index',
776 [
777 'label' => esc_html__( 'Z-Index', 'elementor' ),
778 'type' => Controls_Manager::NUMBER,
779 'min' => 0,
780 'selectors' => [
781 '{{WRAPPER}}' => 'z-index: {{VALUE}};',
782 ],
783 ]
784 );
785
786 $this->add_control(
787 '_element_id',
788 [
789 'label' => esc_html__( 'CSS ID', 'elementor' ),
790 'type' => Controls_Manager::TEXT,
791 'default' => '',
792 'dynamic' => [
793 'active' => true,
794 ],
795 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
796 'style_transfer' => false,
797 'classes' => 'elementor-control-direction-ltr',
798 ]
799 );
800
801 $this->add_control(
802 'css_classes',
803 [
804 'label' => esc_html__( 'CSS Classes', 'elementor' ),
805 'type' => Controls_Manager::TEXT,
806 'default' => '',
807 'dynamic' => [
808 'active' => true,
809 ],
810 'prefix_class' => '',
811 'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
812 'classes' => 'elementor-control-direction-ltr',
813 ]
814 );
815
816 // TODO: Backward comparability for deprecated controls
817 $this->add_control(
818 'screen_sm',
819 [
820 'type' => Controls_Manager::HIDDEN,
821 ]
822 );
823
824 $this->add_control(
825 'screen_sm_width',
826 [
827 'type' => Controls_Manager::HIDDEN,
828 'condition' => [
829 'screen_sm' => [ 'custom' ],
830 ],
831 'prefix_class' => 'elementor-sm-',
832 ]
833 );
834 // END Backward comparability
835
836 $this->end_controls_section();
837
838 $this->start_controls_section(
839 'section_effects',
840 [
841 'label' => esc_html__( 'Motion Effects', 'elementor' ),
842 'tab' => Controls_Manager::TAB_ADVANCED,
843 ]
844 );
845
846 $this->add_responsive_control(
847 'animation',
848 [
849 'label' => esc_html__( 'Entrance Animation', 'elementor' ),
850 'type' => Controls_Manager::ANIMATION,
851 'frontend_available' => true,
852 ]
853 );
854
855 $this->add_control(
856 'animation_duration',
857 [
858 'label' => esc_html__( 'Animation Duration', 'elementor' ),
859 'type' => Controls_Manager::SELECT,
860 'default' => '',
861 'options' => [
862 'slow' => esc_html__( 'Slow', 'elementor' ),
863 '' => esc_html__( 'Normal', 'elementor' ),
864 'fast' => esc_html__( 'Fast', 'elementor' ),
865 ],
866 'prefix_class' => 'animated-',
867 'condition' => [
868 'animation!' => '',
869 ],
870 ]
871 );
872
873 $this->add_control(
874 'animation_delay',
875 [
876 'label' => esc_html__( 'Animation Delay', 'elementor' ) . ' (ms)',
877 'type' => Controls_Manager::NUMBER,
878 'default' => '',
879 'min' => 0,
880 'step' => 100,
881 'condition' => [
882 'animation!' => '',
883 ],
884 'render_type' => 'none',
885 'frontend_available' => true,
886 ]
887 );
888
889 $this->end_controls_section();
890
891 $this->start_controls_section(
892 '_section_responsive',
893 [
894 'label' => esc_html__( 'Responsive', 'elementor' ),
895 'tab' => Controls_Manager::TAB_ADVANCED,
896 ]
897 );
898
899 $this->add_control(
900 'responsive_description',
901 [
902 'raw' => esc_html__( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ),
903 'type' => Controls_Manager::RAW_HTML,
904 'content_classes' => 'elementor-descriptor',
905 ]
906 );
907
908 $this->add_hidden_device_controls();
909
910 $this->end_controls_section();
911
912 Plugin::$instance->controls_manager->add_custom_attributes_controls( $this );
913
914 Plugin::$instance->controls_manager->add_custom_css_controls( $this );
915 }
916
917 /**
918 * Render column output in the editor.
919 *
920 * Used to generate the live preview, using a Backbone JavaScript template.
921 *
922 * @since 2.9.0
923 * @access protected
924 */
925 protected function content_template() {
926 $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
927 $wrapper_element = $is_dom_optimization_active ? 'widget' : 'column';
928
929 ?>
930 <div class="elementor-<?php echo esc_attr( $wrapper_element ); ?>-wrap">
931 <div class="elementor-background-overlay"></div>
932 <?php if ( ! $is_dom_optimization_active ) { ?>
933 <div class="elementor-widget-wrap"></div>
934 <?php } ?>
935 </div>
936 <?php
937 }
938
939 /**
940 * Before column rendering.
941 *
942 * Used to add stuff before the column element.
943 *
944 * @since 1.0.0
945 * @access public
946 */
947 public function before_render() {
948 $settings = $this->get_settings_for_display();
949
950 $has_background_overlay = in_array( $settings['background_overlay_background'], [ 'classic', 'gradient' ], true ) ||
951 in_array( $settings['background_overlay_hover_background'], [ 'classic', 'gradient' ], true );
952
953 $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
954 $wrapper_attribute_string = $is_dom_optimization_active ? '_widget_wrapper' : '_inner_wrapper';
955
956 $column_wrap_classes = $is_dom_optimization_active ? [ 'elementor-widget-wrap' ] : [ 'elementor-column-wrap' ];
957
958 if ( $this->get_children() ) {
959 $column_wrap_classes[] = 'elementor-element-populated';
960 }
961
962 $this->add_render_attribute( [
963 '_inner_wrapper' => [
964 'class' => $column_wrap_classes,
965 ],
966 '_widget_wrapper' => [
967 'class' => $is_dom_optimization_active ? $column_wrap_classes : 'elementor-widget-wrap',
968 ],
969 '_background_overlay' => [
970 'class' => [ 'elementor-background-overlay' ],
971 ],
972 ] );
973 ?>
974 <<?php
975 // PHPCS - the method get_html_tag is safe.
976 echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
977 ?> <?php $this->print_render_attribute_string( '_wrapper' ); ?>>
978 <div <?php $this->print_render_attribute_string( $wrapper_attribute_string ); ?>>
979 <?php if ( $has_background_overlay ) : ?>
980 <div <?php $this->print_render_attribute_string( '_background_overlay' ); ?>></div>
981 <?php endif; ?>
982 <?php if ( ! $is_dom_optimization_active ) : ?>
983 <div <?php $this->print_render_attribute_string( '_widget_wrapper' ); ?>>
984 <?php endif; ?>
985 <?php
986 }
987
988 /**
989 * After column rendering.
990 *
991 * Used to add stuff after the column element.
992 *
993 * @since 1.0.0
994 * @access public
995 */
996 public function after_render() {
997 if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?>
998 </div>
999 <?php } ?>
1000 </div>
1001 </<?php
1002 // PHPCS - the method get_html_tag is safe.
1003 echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
1004 <?php
1005 }
1006
1007 /**
1008 * Add column render attributes.
1009 *
1010 * Used to add attributes to the current column wrapper HTML tag.
1011 *
1012 * @since 1.3.0
1013 * @access protected
1014 */
1015 protected function add_render_attributes() {
1016
1017 $is_inner = $this->get_data( 'isInner' );
1018
1019 $column_type = ! empty( $is_inner ) ? 'inner' : 'top';
1020
1021 $settings = $this->get_settings();
1022
1023 $this->add_render_attribute(
1024 '_wrapper', 'class', [
1025 'elementor-column',
1026 'elementor-col-' . $settings['_column_size'],
1027 'elementor-' . $column_type . '-column',
1028 ]
1029 );
1030
1031 parent::add_render_attributes();
1032 }
1033
1034 /**
1035 * Get default child type.
1036 *
1037 * Retrieve the column child type based on element data.
1038 *
1039 * @since 1.0.0
1040 * @access protected
1041 *
1042 * @param array $element_data Element ID.
1043 *
1044 * @return Element_Base|false Column default child type.
1045 */
1046 protected function _get_default_child_type( array $element_data ) {
1047 if ( 'section' === $element_data['elType'] ) {
1048 return Plugin::$instance->elements_manager->get_element_types( 'section' );
1049 }
1050
1051 if ( 'container' === $element_data['elType'] ) {
1052 return Plugin::$instance->elements_manager->get_element_types( 'container' );
1053 }
1054
1055 // If the element doesn't exists (disabled element, experiment, etc.), return false to prevent errors.
1056 if ( empty( $element_data['widgetType'] ) ) {
1057 return false;
1058 }
1059
1060 return Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
1061 }
1062
1063 /**
1064 * Get HTML tag.
1065 *
1066 * Retrieve the column element HTML tag.
1067 *
1068 * @since 1.5.3
1069 * @access private
1070 *
1071 * @return string Column HTML tag.
1072 */
1073 private function get_html_tag() {
1074 $html_tag = $this->get_settings( 'html_tag' );
1075
1076 if ( empty( $html_tag ) ) {
1077 $html_tag = 'div';
1078 }
1079
1080 return Utils::validate_html_tag( $html_tag );
1081 }
1082 }
1083