| 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', 'rem', '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', 'rem', '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', 'vw', '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', 'vw', '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 |
'ai' => [ |
| 793 |
'active' => false, |
| 794 |
], |
| 795 |
'dynamic' => [ |
| 796 |
'active' => true, |
| 797 |
], |
| 798 |
'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ), |
| 799 |
'style_transfer' => false, |
| 800 |
'classes' => 'elementor-control-direction-ltr', |
| 801 |
] |
| 802 |
); |
| 803 |
|
| 804 |
$this->add_control( |
| 805 |
'css_classes', |
| 806 |
[ |
| 807 |
'label' => esc_html__( 'CSS Classes', 'elementor' ), |
| 808 |
'type' => Controls_Manager::TEXT, |
| 809 |
'default' => '', |
| 810 |
'ai' => [ |
| 811 |
'active' => false, |
| 812 |
], |
| 813 |
'dynamic' => [ |
| 814 |
'active' => true, |
| 815 |
], |
| 816 |
'prefix_class' => '', |
| 817 |
'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ), |
| 818 |
'classes' => 'elementor-control-direction-ltr', |
| 819 |
] |
| 820 |
); |
| 821 |
|
| 822 |
// TODO: Backward comparability for deprecated controls |
| 823 |
$this->add_control( |
| 824 |
'screen_sm', |
| 825 |
[ |
| 826 |
'type' => Controls_Manager::HIDDEN, |
| 827 |
] |
| 828 |
); |
| 829 |
|
| 830 |
$this->add_control( |
| 831 |
'screen_sm_width', |
| 832 |
[ |
| 833 |
'type' => Controls_Manager::HIDDEN, |
| 834 |
'condition' => [ |
| 835 |
'screen_sm' => [ 'custom' ], |
| 836 |
], |
| 837 |
'prefix_class' => 'elementor-sm-', |
| 838 |
] |
| 839 |
); |
| 840 |
// END Backward comparability |
| 841 |
|
| 842 |
$this->end_controls_section(); |
| 843 |
|
| 844 |
$this->start_controls_section( |
| 845 |
'section_effects', |
| 846 |
[ |
| 847 |
'label' => esc_html__( 'Motion Effects', 'elementor' ), |
| 848 |
'tab' => Controls_Manager::TAB_ADVANCED, |
| 849 |
] |
| 850 |
); |
| 851 |
|
| 852 |
$this->add_responsive_control( |
| 853 |
'animation', |
| 854 |
[ |
| 855 |
'label' => esc_html__( 'Entrance Animation', 'elementor' ), |
| 856 |
'type' => Controls_Manager::ANIMATION, |
| 857 |
'frontend_available' => true, |
| 858 |
] |
| 859 |
); |
| 860 |
|
| 861 |
$this->add_control( |
| 862 |
'animation_duration', |
| 863 |
[ |
| 864 |
'label' => esc_html__( 'Animation Duration', 'elementor' ), |
| 865 |
'type' => Controls_Manager::SELECT, |
| 866 |
'default' => '', |
| 867 |
'options' => [ |
| 868 |
'slow' => esc_html__( 'Slow', 'elementor' ), |
| 869 |
'' => esc_html__( 'Normal', 'elementor' ), |
| 870 |
'fast' => esc_html__( 'Fast', 'elementor' ), |
| 871 |
], |
| 872 |
'prefix_class' => 'animated-', |
| 873 |
'condition' => [ |
| 874 |
'animation!' => '', |
| 875 |
], |
| 876 |
] |
| 877 |
); |
| 878 |
|
| 879 |
$this->add_control( |
| 880 |
'animation_delay', |
| 881 |
[ |
| 882 |
'label' => esc_html__( 'Animation Delay', 'elementor' ) . ' (ms)', |
| 883 |
'type' => Controls_Manager::NUMBER, |
| 884 |
'default' => '', |
| 885 |
'min' => 0, |
| 886 |
'step' => 100, |
| 887 |
'condition' => [ |
| 888 |
'animation!' => '', |
| 889 |
], |
| 890 |
'render_type' => 'none', |
| 891 |
'frontend_available' => true, |
| 892 |
] |
| 893 |
); |
| 894 |
|
| 895 |
$this->end_controls_section(); |
| 896 |
|
| 897 |
$this->start_controls_section( |
| 898 |
'_section_responsive', |
| 899 |
[ |
| 900 |
'label' => esc_html__( 'Responsive', 'elementor' ), |
| 901 |
'tab' => Controls_Manager::TAB_ADVANCED, |
| 902 |
] |
| 903 |
); |
| 904 |
|
| 905 |
$this->add_control( |
| 906 |
'responsive_description', |
| 907 |
[ |
| 908 |
'raw' => sprintf( |
| 909 |
/* translators: 1: Link open tag, 2: Link close tag. */ |
| 910 |
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' ), |
| 911 |
'<a href="javascript: $e.run( \'panel/close\' )">', |
| 912 |
'</a>' |
| 913 |
), |
| 914 |
'type' => Controls_Manager::RAW_HTML, |
| 915 |
'content_classes' => 'elementor-descriptor', |
| 916 |
] |
| 917 |
); |
| 918 |
|
| 919 |
$this->add_hidden_device_controls(); |
| 920 |
|
| 921 |
$this->end_controls_section(); |
| 922 |
|
| 923 |
Plugin::$instance->controls_manager->add_custom_attributes_controls( $this ); |
| 924 |
|
| 925 |
Plugin::$instance->controls_manager->add_custom_css_controls( $this ); |
| 926 |
} |
| 927 |
|
| 928 |
/** |
| 929 |
* Render column output in the editor. |
| 930 |
* |
| 931 |
* Used to generate the live preview, using a Backbone JavaScript template. |
| 932 |
* |
| 933 |
* @since 2.9.0 |
| 934 |
* @access protected |
| 935 |
*/ |
| 936 |
protected function content_template() { |
| 937 |
$is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ); |
| 938 |
$wrapper_element = $is_dom_optimization_active ? 'widget' : 'column'; |
| 939 |
|
| 940 |
?> |
| 941 |
<div class="elementor-<?php echo esc_attr( $wrapper_element ); ?>-wrap"> |
| 942 |
<div class="elementor-background-overlay"></div> |
| 943 |
<?php if ( ! $is_dom_optimization_active ) { ?> |
| 944 |
<div class="elementor-widget-wrap"></div> |
| 945 |
<?php } ?> |
| 946 |
</div> |
| 947 |
<?php |
| 948 |
} |
| 949 |
|
| 950 |
/** |
| 951 |
* Before column rendering. |
| 952 |
* |
| 953 |
* Used to add stuff before the column element. |
| 954 |
* |
| 955 |
* @since 1.0.0 |
| 956 |
* @access public |
| 957 |
*/ |
| 958 |
public function before_render() { |
| 959 |
$settings = $this->get_settings_for_display(); |
| 960 |
|
| 961 |
$has_background_overlay = in_array( $settings['background_overlay_background'], [ 'classic', 'gradient' ], true ) || |
| 962 |
in_array( $settings['background_overlay_hover_background'], [ 'classic', 'gradient' ], true ); |
| 963 |
|
| 964 |
$is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ); |
| 965 |
$wrapper_attribute_string = $is_dom_optimization_active ? '_widget_wrapper' : '_inner_wrapper'; |
| 966 |
|
| 967 |
$column_wrap_classes = $is_dom_optimization_active ? [ 'elementor-widget-wrap' ] : [ 'elementor-column-wrap' ]; |
| 968 |
|
| 969 |
if ( $this->get_children() ) { |
| 970 |
$column_wrap_classes[] = 'elementor-element-populated'; |
| 971 |
} |
| 972 |
|
| 973 |
$this->add_render_attribute( [ |
| 974 |
'_inner_wrapper' => [ |
| 975 |
'class' => $column_wrap_classes, |
| 976 |
], |
| 977 |
'_widget_wrapper' => [ |
| 978 |
'class' => $is_dom_optimization_active ? $column_wrap_classes : 'elementor-widget-wrap', |
| 979 |
], |
| 980 |
'_background_overlay' => [ |
| 981 |
'class' => [ 'elementor-background-overlay' ], |
| 982 |
], |
| 983 |
] ); |
| 984 |
?> |
| 985 |
<<?php |
| 986 |
// PHPCS - the method get_html_tag is safe. |
| 987 |
echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 988 |
?> <?php $this->print_render_attribute_string( '_wrapper' ); ?>> |
| 989 |
<div <?php $this->print_render_attribute_string( $wrapper_attribute_string ); ?>> |
| 990 |
<?php if ( $has_background_overlay ) : ?> |
| 991 |
<div <?php $this->print_render_attribute_string( '_background_overlay' ); ?>></div> |
| 992 |
<?php endif; ?> |
| 993 |
<?php if ( ! $is_dom_optimization_active ) : ?> |
| 994 |
<div <?php $this->print_render_attribute_string( '_widget_wrapper' ); ?>> |
| 995 |
<?php endif; ?> |
| 996 |
<?php |
| 997 |
} |
| 998 |
|
| 999 |
/** |
| 1000 |
* After column rendering. |
| 1001 |
* |
| 1002 |
* Used to add stuff after the column element. |
| 1003 |
* |
| 1004 |
* @since 1.0.0 |
| 1005 |
* @access public |
| 1006 |
*/ |
| 1007 |
public function after_render() { |
| 1008 |
if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { ?> |
| 1009 |
</div> |
| 1010 |
<?php } ?> |
| 1011 |
</div> |
| 1012 |
</<?php |
| 1013 |
// PHPCS - the method get_html_tag is safe. |
| 1014 |
echo $this->get_html_tag(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> |
| 1015 |
<?php |
| 1016 |
} |
| 1017 |
|
| 1018 |
/** |
| 1019 |
* Add column render attributes. |
| 1020 |
* |
| 1021 |
* Used to add attributes to the current column wrapper HTML tag. |
| 1022 |
* |
| 1023 |
* @since 1.3.0 |
| 1024 |
* @access protected |
| 1025 |
*/ |
| 1026 |
protected function add_render_attributes() { |
| 1027 |
|
| 1028 |
$is_inner = $this->get_data( 'isInner' ); |
| 1029 |
|
| 1030 |
$column_type = ! empty( $is_inner ) ? 'inner' : 'top'; |
| 1031 |
|
| 1032 |
$settings = $this->get_settings(); |
| 1033 |
|
| 1034 |
$this->add_render_attribute( |
| 1035 |
'_wrapper', 'class', [ |
| 1036 |
'elementor-column', |
| 1037 |
'elementor-col-' . $settings['_column_size'], |
| 1038 |
'elementor-' . $column_type . '-column', |
| 1039 |
] |
| 1040 |
); |
| 1041 |
|
| 1042 |
parent::add_render_attributes(); |
| 1043 |
} |
| 1044 |
|
| 1045 |
/** |
| 1046 |
* Get default child type. |
| 1047 |
* |
| 1048 |
* Retrieve the column child type based on element data. |
| 1049 |
* |
| 1050 |
* @since 1.0.0 |
| 1051 |
* @access protected |
| 1052 |
* |
| 1053 |
* @param array $element_data Element ID. |
| 1054 |
* |
| 1055 |
* @return Element_Base|false Column default child type. |
| 1056 |
*/ |
| 1057 |
protected function _get_default_child_type( array $element_data ) { |
| 1058 |
if ( 'section' === $element_data['elType'] ) { |
| 1059 |
return Plugin::$instance->elements_manager->get_element_types( 'section' ); |
| 1060 |
} |
| 1061 |
|
| 1062 |
if ( 'container' === $element_data['elType'] ) { |
| 1063 |
return Plugin::$instance->elements_manager->get_element_types( 'container' ); |
| 1064 |
} |
| 1065 |
|
| 1066 |
// If the element doesn't exists (disabled element, experiment, etc.), return false to prevent errors. |
| 1067 |
if ( empty( $element_data['widgetType'] ) ) { |
| 1068 |
return false; |
| 1069 |
} |
| 1070 |
|
| 1071 |
return Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] ); |
| 1072 |
} |
| 1073 |
|
| 1074 |
/** |
| 1075 |
* Get HTML tag. |
| 1076 |
* |
| 1077 |
* Retrieve the column element HTML tag. |
| 1078 |
* |
| 1079 |
* @since 1.5.3 |
| 1080 |
* @access private |
| 1081 |
* |
| 1082 |
* @return string Column HTML tag. |
| 1083 |
*/ |
| 1084 |
private function get_html_tag() { |
| 1085 |
$html_tag = $this->get_settings( 'html_tag' ); |
| 1086 |
|
| 1087 |
if ( empty( $html_tag ) ) { |
| 1088 |
$html_tag = 'div'; |
| 1089 |
} |
| 1090 |
|
| 1091 |
return Utils::validate_html_tag( $html_tag ); |
| 1092 |
} |
| 1093 |
} |
| 1094 |
|