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

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