PluginProbe
Elementor Website Builder – more than just a page builder / 3.10.0-dev1
Elementor Website Builder – more than just a page builder v3.10.0-dev1
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.10.0-dev1, at includes/elements/column.php

1,061 lines 27.8 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 ],
302 ],
303 ],
304 ]
305 );
306
307 $this->end_controls_tab();
308
309 $this->start_controls_tab(
310 'tab_background_hover',
311 [
312 'label' => esc_html__( 'Hover', 'elementor' ),
313 ]
314 );
315
316 $this->add_group_control(
317 Group_Control_Background::get_type(),
318 [
319 'name' => 'background_hover',
320 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
321 ]
322 );
323
324 $this->add_control(
325 'background_hover_transition',
326 [
327 'label' => esc_html__( 'Transition Duration', 'elementor' ),
328 'type' => Controls_Manager::SLIDER,
329 'size_units' => [ 's', 'ms' ],
330 'default' => [
331 'unit' => 's',
332 'size' => 0.3,
333 ],
334 'render_type' => 'ui',
335 'separator' => 'before',
336 ]
337 );
338
339 $this->end_controls_tab();
340
341 $this->end_controls_tabs();
342
343 $this->end_controls_section();
344
345 // Section Column Background Overlay.
346 $this->start_controls_section(
347 'section_background_overlay',
348 [
349 'label' => esc_html__( 'Background Overlay', 'elementor' ),
350 'tab' => Controls_Manager::TAB_STYLE,
351 'condition' => [
352 'background_background' => [ 'classic', 'gradient' ],
353 ],
354 ]
355 );
356
357 $this->start_controls_tabs( 'tabs_background_overlay' );
358
359 $this->start_controls_tab(
360 'tab_background_overlay_normal',
361 [
362 'label' => esc_html__( 'Normal', 'elementor' ),
363 ]
364 );
365
366 $this->add_group_control(
367 Group_Control_Background::get_type(),
368 [
369 'name' => 'background_overlay',
370 'selector' => '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay',
371 ]
372 );
373
374 $this->add_responsive_control(
375 'background_overlay_opacity',
376 [
377 'label' => esc_html__( 'Opacity', 'elementor' ),
378 'type' => Controls_Manager::SLIDER,
379 'default' => [
380 'size' => .5,
381 ],
382 'range' => [
383 'px' => [
384 'max' => 1,
385 'step' => 0.01,
386 ],
387 ],
388 'selectors' => [
389 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'opacity: {{SIZE}};',
390 ],
391 'condition' => [
392 'background_overlay_background' => [ 'classic', 'gradient' ],
393 ],
394 ]
395 );
396
397 $this->add_group_control(
398 Group_Control_Css_Filter::get_type(),
399 [
400 'name' => 'css_filters',
401 'selector' => '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay',
402 ]
403 );
404
405 $this->add_control(
406 'overlay_blend_mode',
407 [
408 'label' => esc_html__( 'Blend Mode', 'elementor' ),
409 'type' => Controls_Manager::SELECT,
410 'options' => [
411 '' => esc_html__( 'Normal', 'elementor' ),
412 'multiply' => esc_html__( 'Multiply', 'elementor' ),
413 'screen' => esc_html__( 'Screen', 'elementor' ),
414 'overlay' => esc_html__( 'Overlay', 'elementor' ),
415 'darken' => esc_html__( 'Darken', 'elementor' ),
416 'lighten' => esc_html__( 'Lighten', 'elementor' ),
417 'color-dodge' => esc_html__( 'Color Dodge', 'elementor' ),
418 'saturation' => esc_html__( 'Saturation', 'elementor' ),
419 'color' => esc_html__( 'Color', 'elementor' ),
420 'difference' => esc_html__( 'Difference', 'elementor' ),
421 'exclusion' => esc_html__( 'Exclusion', 'elementor' ),
422 'hue' => esc_html__( 'Hue', 'elementor' ),
423 'luminosity' => esc_html__( 'Luminosity', 'elementor' ),
424 ],
425 'selectors' => [
426 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'mix-blend-mode: {{VALUE}}',
427 ],
428 ]
429 );
430
431 $this->end_controls_tab();
432
433 $this->start_controls_tab(
434 'tab_background_overlay_hover',
435 [
436 'label' => esc_html__( 'Hover', 'elementor' ),
437 ]
438 );
439
440 $this->add_group_control(
441 Group_Control_Background::get_type(),
442 [
443 'name' => 'background_overlay_hover',
444 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay',
445 ]
446 );
447
448 $this->add_responsive_control(
449 'background_overlay_hover_opacity',
450 [
451 'label' => esc_html__( 'Opacity', 'elementor' ),
452 'type' => Controls_Manager::SLIDER,
453 'default' => [
454 'size' => .5,
455 ],
456 'range' => [
457 'px' => [
458 'max' => 1,
459 'step' => 0.01,
460 ],
461 ],
462 'selectors' => [
463 '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay' => 'opacity: {{SIZE}};',
464 ],
465 'condition' => [
466 'background_overlay_hover_background' => [ 'classic', 'gradient' ],
467 ],
468 ]
469 );
470
471 $this->add_group_control(
472 Group_Control_Css_Filter::get_type(),
473 [
474 'name' => 'css_filters_hover',
475 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay',
476 ]
477 );
478
479 $this->add_control(
480 'background_overlay_hover_transition',
481 [
482 'label' => esc_html__( 'Transition Duration', 'elementor' ),
483 'type' => Controls_Manager::SLIDER,
484 'size_units' => [ 's', 'ms' ],
485 'default' => [
486 'unit' => 's',
487 'size' => 0.3,
488 ],
489 'render_type' => 'ui',
490 'separator' => 'before',
491 ]
492 );
493
494 $this->end_controls_tab();
495
496 $this->end_controls_tabs();
497
498 $this->end_controls_section();
499
500 $this->start_controls_section(
501 'section_border',
502 [
503 'label' => esc_html__( 'Border', 'elementor' ),
504 'tab' => Controls_Manager::TAB_STYLE,
505 ]
506 );
507
508 $this->start_controls_tabs( 'tabs_border' );
509
510 $this->start_controls_tab(
511 'tab_border_normal',
512 [
513 'label' => esc_html__( 'Normal', 'elementor' ),
514 ]
515 );
516
517 $this->add_group_control(
518 Group_Control_Border::get_type(),
519 [
520 'name' => 'border',
521 'selector' => '{{WRAPPER}} > .elementor-element-populated',
522 ]
523 );
524
525 $this->add_responsive_control(
526 'border_radius',
527 [
528 'label' => esc_html__( 'Border Radius', 'elementor' ),
529 'type' => Controls_Manager::DIMENSIONS,
530 'size_units' => [ 'px', '%', 'em' ],
531 'selectors' => [
532 '{{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}};',
533 ],
534 ]
535 );
536
537 $this->add_group_control(
538 Group_Control_Box_Shadow::get_type(),
539 [
540 'name' => 'box_shadow',
541 'selector' => '{{WRAPPER}} > .elementor-element-populated',
542 ]
543 );
544
545 $this->end_controls_tab();
546
547 $this->start_controls_tab(
548 'tab_border_hover',
549 [
550 'label' => esc_html__( 'Hover', 'elementor' ),
551 ]
552 );
553
554 $this->add_group_control(
555 Group_Control_Border::get_type(),
556 [
557 'name' => 'border_hover',
558 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
559 ]
560 );
561
562 $this->add_responsive_control(
563 'border_radius_hover',
564 [
565 'label' => esc_html__( 'Border Radius', 'elementor' ),
566 'type' => Controls_Manager::DIMENSIONS,
567 'size_units' => [ 'px', '%', 'em' ],
568 'selectors' => [
569 '{{WRAPPER}}:hover > .elementor-element-populated, {{WRAPPER}}:hover > .elementor-element-populated > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
570 ],
571 ]
572 );
573
574 $this->add_group_control(
575 Group_Control_Box_Shadow::get_type(),
576 [
577 'name' => 'box_shadow_hover',
578 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated',
579 ]
580 );
581
582 $this->add_control(
583 'border_hover_transition',
584 [
585 'label' => esc_html__( 'Transition Duration', 'elementor' ),
586 'type' => Controls_Manager::SLIDER,
587 'separator' => 'before',
588 'size_units' => [ 's', 'ms' ],
589 'default' => [
590 'unit' => 's',
591 'size' => 0.3,
592 ],
593 'conditions' => [
594 'relation' => 'or',
595 'terms' => [
596 [
597 'name' => 'background_background',
598 'operator' => '!==',
599 'value' => '',
600 ],
601 [
602 'name' => 'border_border',
603 'operator' => '!==',
604 'value' => '',
605 ],
606 ],
607 ],
608 'selectors' => [
609 '{{WRAPPER}} > .elementor-element-populated' => 'transition: background {{background_hover_transition.SIZE}}{{background_hover_transition.UNIT}}, border {{SIZE}}{{UNIT}}, border-radius {{SIZE}}{{UNIT}}, box-shadow {{SIZE}}{{UNIT}}',
610 '{{WRAPPER}} > .elementor-element-populated > .elementor-background-overlay' => 'transition: background {{background_overlay_hover_transition.SIZE}}{{background_overlay_hover_transition.UNIT}}, border-radius {{SIZE}}{{UNIT}}, opacity {{background_overlay_hover_transition.SIZE}}{{background_overlay_hover_transition.UNIT}}',
611 ],
612 ]
613 );
614
615 $this->end_controls_tab();
616
617 $this->end_controls_tabs();
618
619 $this->end_controls_section();
620
621 // Section Typography.
622 $this->start_controls_section(
623 'section_typo',
624 [
625 'label' => esc_html__( 'Typography', 'elementor' ),
626 'type' => Controls_Manager::SECTION,
627 'tab' => Controls_Manager::TAB_STYLE,
628 ]
629 );
630
631 $this->add_control(
632 'heading_color',
633 [
634 'label' => esc_html__( 'Heading Color', 'elementor' ),
635 'type' => Controls_Manager::COLOR,
636 'default' => '',
637 'selectors' => [
638 '{{WRAPPER}} .elementor-element-populated .elementor-heading-title' => 'color: {{VALUE}};',
639 ],
640 'separator' => 'none',
641 ]
642 );
643
644 $this->add_control(
645 'color_text',
646 [
647 'label' => esc_html__( 'Text Color', 'elementor' ),
648 'type' => Controls_Manager::COLOR,
649 'default' => '',
650 'selectors' => [
651 '{{WRAPPER}} > .elementor-element-populated' => 'color: {{VALUE}};',
652 ],
653 ]
654 );
655
656 $this->add_control(
657 'color_link',
658 [
659 'label' => esc_html__( 'Link Color', 'elementor' ),
660 'type' => Controls_Manager::COLOR,
661 'default' => '',
662 'selectors' => [
663 '{{WRAPPER}} .elementor-element-populated a' => 'color: {{VALUE}};',
664 ],
665 ]
666 );
667
668 $this->add_control(
669 'color_link_hover',
670 [
671 'label' => esc_html__( 'Link Hover Color', 'elementor' ),
672 'type' => Controls_Manager::COLOR,
673 'default' => '',
674 'selectors' => [
675 '{{WRAPPER}} .elementor-element-populated a:hover' => 'color: {{VALUE}};',
676 ],
677 ]
678 );
679
680 $this->add_responsive_control(
681 'text_align',
682 [
683 'label' => esc_html__( 'Text Align', 'elementor' ),
684 'type' => Controls_Manager::CHOOSE,
685 'options' => [
686 'left' => [
687 'title' => esc_html__( 'Left', 'elementor' ),
688 'icon' => 'eicon-text-align-left',
689 ],
690 'center' => [
691 'title' => esc_html__( 'Center', 'elementor' ),
692 'icon' => 'eicon-text-align-center',
693 ],
694 'right' => [
695 'title' => esc_html__( 'Right', 'elementor' ),
696 'icon' => 'eicon-text-align-right',
697 ],
698 'justify' => [
699 'title' => esc_html__( 'Justified', 'elementor' ),
700 'icon' => 'eicon-text-align-justify',
701 ],
702 ],
703 'selectors' => [
704 '{{WRAPPER}} > .elementor-element-populated' => 'text-align: {{VALUE}};',
705 ],
706 ]
707 );
708
709 $this->end_controls_section();
710
711 // Section Advanced.
712 $this->start_controls_section(
713 'section_advanced',
714 [
715 'label' => esc_html__( 'Advanced', 'elementor' ),
716 'type' => Controls_Manager::SECTION,
717 'tab' => Controls_Manager::TAB_ADVANCED,
718 ]
719 );
720
721 $this->add_responsive_control(
722 'margin',
723 [
724 'label' => esc_html__( 'Margin', 'elementor' ),
725 'type' => Controls_Manager::DIMENSIONS,
726 'size_units' => [ 'px', 'em', '%', 'rem' ],
727 'selectors' => [
728 '{{WRAPPER}} > .elementor-element-populated' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};
729 --e-column-margin-right: {{RIGHT}}{{UNIT}}; --e-column-margin-left: {{LEFT}}{{UNIT}};',
730 ],
731 ]
732 );
733
734 $padding_selector = '{{WRAPPER}} > .elementor-element-populated';
735
736 if ( ! $is_dome_optimization_active ) {
737 $padding_selector .= ' > .elementor-widget-wrap';
738 }
739
740 $this->add_responsive_control(
741 'padding',
742 [
743 'label' => esc_html__( 'Padding', 'elementor' ),
744 'type' => Controls_Manager::DIMENSIONS,
745 'size_units' => [ 'px', 'em', '%', 'rem' ],
746 'selectors' => [
747 $padding_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
748 ],
749 ]
750 );
751
752 $this->add_responsive_control(
753 'z_index',
754 [
755 'label' => esc_html__( 'Z-Index', 'elementor' ),
756 'type' => Controls_Manager::NUMBER,
757 'min' => 0,
758 'selectors' => [
759 '{{WRAPPER}}' => 'z-index: {{VALUE}};',
760 ],
761 ]
762 );
763
764 $this->add_control(
765 '_element_id',
766 [
767 'label' => esc_html__( 'CSS ID', 'elementor' ),
768 'type' => Controls_Manager::TEXT,
769 'default' => '',
770 'dynamic' => [
771 'active' => true,
772 ],
773 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
774 'style_transfer' => false,
775 'classes' => 'elementor-control-direction-ltr',
776 ]
777 );
778
779 $this->add_control(
780 'css_classes',
781 [
782 'label' => esc_html__( 'CSS Classes', 'elementor' ),
783 'type' => Controls_Manager::TEXT,
784 'default' => '',
785 'dynamic' => [
786 'active' => true,
787 ],
788 'prefix_class' => '',
789 'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
790 'classes' => 'elementor-control-direction-ltr',
791 ]
792 );
793
794 // TODO: Backward comparability for deprecated controls
795 $this->add_control(
796 'screen_sm',
797 [
798 'type' => Controls_Manager::HIDDEN,
799 ]
800 );
801
802 $this->add_control(
803 'screen_sm_width',
804 [
805 'type' => Controls_Manager::HIDDEN,
806 'condition' => [
807 'screen_sm' => [ 'custom' ],
808 ],
809 'prefix_class' => 'elementor-sm-',
810 ]
811 );
812 // END Backward comparability
813
814 $this->end_controls_section();
815
816 $this->start_controls_section(
817 'section_effects',
818 [
819 'label' => esc_html__( 'Motion Effects', 'elementor' ),
820 'tab' => Controls_Manager::TAB_ADVANCED,
821 ]
822 );
823
824 $this->add_responsive_control(
825 'animation',
826 [
827 'label' => esc_html__( 'Entrance Animation', 'elementor' ),
828 'type' => Controls_Manager::ANIMATION,
829 'frontend_available' => true,
830 ]
831 );
832
833 $this->add_control(
834 'animation_duration',
835 [
836 'label' => esc_html__( 'Animation Duration', 'elementor' ),
837 'type' => Controls_Manager::SELECT,
838 'default' => '',
839 'options' => [
840 'slow' => esc_html__( 'Slow', 'elementor' ),
841 '' => esc_html__( 'Normal', 'elementor' ),
842 'fast' => esc_html__( 'Fast', 'elementor' ),
843 ],
844 'prefix_class' => 'animated-',
845 'condition' => [
846 'animation!' => '',
847 ],
848 ]
849 );
850
851 $this->add_control(
852 'animation_delay',
853 [
854 'label' => esc_html__( 'Animation Delay', 'elementor' ) . ' (ms)',
855 'type' => Controls_Manager::NUMBER,
856 'default' => '',
857 'min' => 0,
858 'step' => 100,
859 'condition' => [
860 'animation!' => '',
861 ],
862 'render_type' => 'none',
863 'frontend_available' => true,
864 ]
865 );
866
867 $this->end_controls_section();
868
869 $this->start_controls_section(
870 '_section_responsive',
871 [
872 'label' => esc_html__( 'Responsive', 'elementor' ),
873 'tab' => Controls_Manager::TAB_ADVANCED,
874 ]
875 );
876
877 $this->add_control(
878 'responsive_description',
879 [
880 'raw' => esc_html__( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ),
881 'type' => Controls_Manager::RAW_HTML,
882 'content_classes' => 'elementor-descriptor',
883 ]
884 );
885
886 $this->add_hidden_device_controls();
887
888 $this->end_controls_section();
889
890 Plugin::$instance->controls_manager->add_custom_attributes_controls( $this );
891
892 Plugin::$instance->controls_manager->add_custom_css_controls( $this );
893 }
894
895 /**
896 * Render column output in the editor.
897 *
898 * Used to generate the live preview, using a Backbone JavaScript template.
899 *
900 * @since 2.9.0
901 * @access protected
902 */
903 protected function content_template() {
904 $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
905 $wrapper_element = $is_dom_optimization_active ? 'widget' : 'column';
906
907 ?>
908 <div class="elementor-<?php echo esc_attr( $wrapper_element ); ?>-wrap">
909 <div class="elementor-background-overlay"></div>
910 <?php if ( ! $is_dom_optimization_active ) { ?>
911 <div class="elementor-widget-wrap"></div>
912 <?php } ?>
913 </div>
914 <?php
915 }
916
917 /**
918 * Before column rendering.
919 *
920 * Used to add stuff before the column element.
921 *
922 * @since 1.0.0
923 * @access public
924 */
925 public function before_render() {
926 $settings = $this->get_settings_for_display();
927
928 $has_background_overlay = in_array( $settings['background_overlay_background'], [ 'classic', 'gradient' ], true ) ||
929 in_array( $settings['background_overlay_hover_background'], [ 'classic', 'gradient' ], true );
930
931 $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
932 $wrapper_attribute_string = $is_dom_optimization_active ? '_widget_wrapper' : '_inner_wrapper';
933
934 $column_wrap_classes = $is_dom_optimization_active ? [ 'elementor-widget-wrap' ] : [ 'elementor-column-wrap' ];
935
936 if ( $this->get_children() ) {
937 $column_wrap_classes[] = 'elementor-element-populated';
938 }
939
940 $this->add_render_attribute( [
941 '_inner_wrapper' => [
942 'class' => $column_wrap_classes,
943 ],
944 '_widget_wrapper' => [
945 'class' => $is_dom_optimization_active ? $column_wrap_classes : 'elementor-widget-wrap',
946 ],
947 '_background_overlay' => [
948 'class' => [ 'elementor-background-overlay' ],
949 ],
950 ] );
951 ?>
952 <<?php
953 // PHPCS - the method get_html_tag is safe.
954 echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
955 ?> <?php $this->print_render_attribute_string( '_wrapper' ); ?>>
956 <div <?php $this->print_render_attribute_string( $wrapper_attribute_string ); ?>>
957 <?php if ( $has_background_overlay ) : ?>
958 <div <?php $this->print_render_attribute_string( '_background_overlay' ); ?>></div>
959 <?php endif; ?>
960 <?php if ( ! $is_dom_optimization_active ) : ?>
961 <div <?php $this->print_render_attribute_string( '_widget_wrapper' ); ?>>
962 <?php endif; ?>
963 <?php
964 }
965
966 /**
967 * After column rendering.
968 *
969 * Used to add stuff after the column element.
970 *
971 * @since 1.0.0
972 * @access public
973 */
974 public function after_render() {
975 if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?>
976 </div>
977 <?php } ?>
978 </div>
979 </<?php
980 // PHPCS - the method get_html_tag is safe.
981 echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
982 <?php
983 }
984
985 /**
986 * Add column render attributes.
987 *
988 * Used to add attributes to the current column wrapper HTML tag.
989 *
990 * @since 1.3.0
991 * @access protected
992 */
993 protected function add_render_attributes() {
994
995 $is_inner = $this->get_data( 'isInner' );
996
997 $column_type = ! empty( $is_inner ) ? 'inner' : 'top';
998
999 $settings = $this->get_settings();
1000
1001 $this->add_render_attribute(
1002 '_wrapper', 'class', [
1003 'elementor-column',
1004 'elementor-col-' . $settings['_column_size'],
1005 'elementor-' . $column_type . '-column',
1006 ]
1007 );
1008
1009 parent::add_render_attributes();
1010 }
1011
1012 /**
1013 * Get default child type.
1014 *
1015 * Retrieve the column child type based on element data.
1016 *
1017 * @since 1.0.0
1018 * @access protected
1019 *
1020 * @param array $element_data Element ID.
1021 *
1022 * @return Element_Base|false Column default child type.
1023 */
1024 protected function _get_default_child_type( array $element_data ) {
1025 if ( 'section' === $element_data['elType'] ) {
1026 return Plugin::$instance->elements_manager->get_element_types( 'section' );
1027 }
1028
1029 if ( 'container' === $element_data['elType'] ) {
1030 return Plugin::$instance->elements_manager->get_element_types( 'container' );
1031 }
1032
1033 // If the element doesn't exists (disabled element, experiment, etc.), return false to prevent errors.
1034 if ( empty( $element_data['widgetType'] ) ) {
1035 return false;
1036 }
1037
1038 return Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
1039 }
1040
1041 /**
1042 * Get HTML tag.
1043 *
1044 * Retrieve the column element HTML tag.
1045 *
1046 * @since 1.5.3
1047 * @access private
1048 *
1049 * @return string Column HTML tag.
1050 */
1051 private function get_html_tag() {
1052 $html_tag = $this->get_settings( 'html_tag' );
1053
1054 if ( empty( $html_tag ) ) {
1055 $html_tag = 'div';
1056 }
1057
1058 return Utils::validate_html_tag( $html_tag );
1059 }
1060 }
1061