ER}}, {{WRAPPER}}::before' => '--border-transition: {{SIZE}}s;', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register the Container's shape dividers controls. * TODO: Copied from `section.php`. * * @return void */ protected function register_shape_dividers_controls() { $this->start_controls_section( 'section_shape_divider', [ 'label' => esc_html__( 'Shape Divider', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_shape_dividers' ); foreach ( [ 'top' => esc_html__( 'Top', 'elementor' ), 'bottom' => esc_html__( 'Bottom', 'elementor' ), ] as $side => $side_label ) { $base_control_key = "shape_divider_$side"; $this->start_controls_tab( "tab_$base_control_key", [ 'label' => $side_label, ] ); $this->add_control( $base_control_key, [ 'label' => esc_html__( 'Type', 'elementor' ), 'type' => Controls_Manager::VISUAL_CHOICE, 'label_block' => true, 'columns' => 2, 'options' => Shapes::get_shapes(), 'render_type' => 'none', 'frontend_available' => true, 'assets' => [ 'styles' => [ [ 'name' => 'e-shapes', 'conditions' => [ 'terms' => [ [ 'name' => $base_control_key, 'operator' => '!==', 'value' => '', ], ], ], ], ], ], ] ); $this->add_control( $base_control_key . '_color', [ 'label' => esc_html__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'condition' => [ "shape_divider_$side!" => '', ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side .elementor-shape-fill, {{WRAPPER}} > .e-con-inner > .elementor-shape-$side .elementor-shape-fill" => 'fill: {{UNIT}};', ], ] ); $this->add_responsive_control( $base_control_key . '_width', [ 'label' => esc_html__( 'Width', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%', 'vw', 'custom' ], 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'range' => [ '%' => [ 'min' => 100, 'max' => 300, ], 'vw' => [ 'min' => 100, 'max' => 300, ], ], 'condition' => [ "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'height_only', Shapes::FILTER_EXCLUDE ) ), ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg, {{WRAPPER}} > .e-con-inner > .elementor-shape-$side svg" => 'width: calc({{SIZE}}{{UNIT}} + 1.3px)', ], ] ); $this->add_responsive_control( $base_control_key . '_height', [ 'label' => esc_html__( 'Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 500, ], 'em' => [ 'max' => 50, ], 'rem' => [ 'max' => 50, ], ], 'condition' => [ "shape_divider_$side!" => '', ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg, {{WRAPPER}} > .e-con-inner > .elementor-shape-$side svg" => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( $base_control_key . '_flip', [ 'label' => esc_html__( 'Flip', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'condition' => [ "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_flip' ) ), ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg, {{WRAPPER}} > .e-con-inner > .elementor-shape-$side svg" => 'transform: translateX(-50%) rotateY(180deg)', ], ] ); $this->add_control( $base_control_key . '_negative', [ 'label' => esc_html__( 'Invert', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'frontend_available' => true, 'condition' => [ "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_negative' ) ), ], 'render_type' => 'none', ] ); $this->add_control( $base_control_key . '_above_content', [ 'label' => esc_html__( 'Bring to Front', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side, {{WRAPPER}} > .e-con-inner > .elementor-shape-$side" => 'z-index: 2; pointer-events: none', ], 'condition' => [ "shape_divider_$side!" => '', ], ] ); $this->end_controls_tab(); } $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register the Container's style tab. * * @return void */ protected function register_style_tab() { $this->register_background_controls(); $this->register_background_overlay_controls(); $this->register_border_controls(); $this->register_shape_dividers_controls(); } /** * Register the Container's advanced style controls. * * @return void */ protected function register_advanced_controls() { $this->start_controls_section( 'section_layout', [ 'label' => esc_html__( 'Layout', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->add_responsive_control( 'margin', [ 'label' => esc_html__( 'Margin', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--margin-top: {{TOP}}{{UNIT}}; --margin-bottom: {{BOTTOM}}{{UNIT}}; --margin-left: {{LEFT}}{{UNIT}}; --margin-right: {{RIGHT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'padding', [ 'label' => esc_html__( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--padding-top: {{TOP}}{{UNIT}}; --padding-bottom: {{BOTTOM}}{{UNIT}}; --padding-left: {{LEFT}}{{UNIT}}; --padding-right: {{RIGHT}}{{UNIT}};', ], ] ); $this->add_control( 'heading_grid_item', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Grid Item', 'elementor' ), 'separator' => 'before', ] ); $this->add_responsive_control( 'grid_column', [ 'label' => esc_html__( 'Column Span', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => ' ' . esc_html__( 'Default', 'elementor' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', 'custom' => esc_html__( 'Custom', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}}' => 'grid-column: span {{VALUE}};', ], ] ); $this->add_responsive_control( 'grid_column_custom', [ 'label' => esc_html__( 'Custom', 'elementor' ), 'type' => Controls_Manager::TEXT, 'ai' => [ 'active' => false, ], 'selectors' => [ '{{WRAPPER}}' => 'grid-column: {{VALUE}}', ], 'condition' => [ 'grid_column' => 'custom', ], ] ); $this->add_responsive_control( 'grid_row', [ 'label' => esc_html__( 'Row Span', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => ' ' . esc_html__( 'Default', 'elementor' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', 'custom' => esc_html__( 'Custom', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}}' => 'grid-row: span {{VALUE}};', ], ] ); $this->add_responsive_control( 'grid_row_custom', [ 'label' => esc_html__( 'Custom', 'elementor' ), 'type' => Controls_Manager::TEXT, 'separator' => 'after', 'ai' => [ 'active' => false, ], 'selectors' => [ '{{WRAPPER}}' => 'grid-row: {{VALUE}}', ], 'condition' => [ 'grid_row' => 'custom', ], ] ); $this->add_group_control( Group_Control_Flex_Item::get_type(), [ 'name' => '_flex', 'include' => [ 'align_self', 'order', 'order_custom', 'size', 'grow', 'shrink', ], 'selector' => '{{WRAPPER}}.e-con', // Hack to increase specificity. 'separator' => 'before', ] ); $this->add_control( 'position_description', [ 'type' => Controls_Manager::ALERT, 'alert_type' => 'warning', 'heading' => esc_html__( 'Please note!', 'elementor' ), 'content' => esc_html__( 'Custom positioning is not considered best practice for responsive web design and should not be used too frequently.', 'elementor' ), 'render_type' => 'ui', 'condition' => [ 'position!' => '', ], ] ); // TODO: Copied from `common.php` - Extract to group control. $this->add_control( 'position', [ 'label' => esc_html__( 'Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => esc_html__( 'Default', 'elementor' ), 'absolute' => esc_html__( 'Absolute', 'elementor' ), 'fixed' => esc_html__( 'Fixed', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}}' => '--position: {{VALUE}};', ], 'frontend_available' => true, 'separator' => 'before', ] ); $left = esc_html__( 'Left', 'elementor' ); $right = esc_html__( 'Right', 'elementor' ); $start = is_rtl() ? $right : $left; $end = ! is_rtl() ? $right : $left; $this->add_control( '_offset_orientation_h', [ 'label' => esc_html__( 'Horizontal Orientation', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'toggle' => false, 'default' => 'start', 'options' => [ 'start' => [ 'title' => $start, 'icon' => 'eicon-h-align-left', ], 'end' => [ 'title' => $end, 'icon' => 'eicon-h-align-right', ], ], 'classes' => 'elementor-control-start-end', 'render_type' => 'ui', 'condition' => [ 'position!' => '', ], ] ); $this->add_responsive_control( '_offset_x', [ 'label' => esc_html__( 'Offset', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -1000, 'max' => 1000, ], '%' => [ 'min' => -200, 'max' => 200, ], 'vw' => [ 'min' => -200, 'max' => 200, ], 'vh' => [ 'min' => -200, 'max' => 200, ], ], 'default' => [ 'size' => 0, ], 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'vh', 'custom' ], 'selectors' => [ 'body:not(.rtl) {{WRAPPER}}' => 'left: {{SIZE}}{{UNIT}}', 'body.rtl {{WRAPPER}}' => 'right: {{SIZE}}{{UNIT}}', ], 'condition' => [ '_offset_orientation_h!' => 'end', 'position!' => '', ], ] ); $this->add_responsive_control( '_offset_x_end', [ 'label' => esc_html__( 'Offset', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -1000, 'max' => 1000, ], '%' => [ 'min' => -200, 'max' => 200, ], 'vw' => [ 'min' => -200, 'max' => 200, ], 'vh' => [ 'min' => -200, 'max' => 200, ], ], 'default' => [ 'size' => 0, ], 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'vh', 'custom' ], 'selectors' => [ 'body:not(.rtl) {{WRAPPER}}' => 'right: {{SIZE}}{{UNIT}}', 'body.rtl {{WRAPPER}}' => 'left: {{SIZE}}{{UNIT}}', ], 'condition' => [ '_offset_orientation_h' => 'end', 'position!' => '', ], ] ); $this->add_control( '_offset_orientation_v', [ 'label' => esc_html__( 'Vertical Orientation', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'toggle' => false, 'default' => 'start', 'options' => [ 'start' => [ 'title' => esc_html__( 'Top', 'elementor' ), 'icon' => 'eicon-v-align-top', ], 'end' => [ 'title' => esc_html__( 'Bottom', 'elementor' ), 'icon' => 'eicon-v-align-bottom', ], ], 'render_type' => 'ui', 'condition' => [ 'position!' => '', ], ] ); $this->add_responsive_control( '_offset_y', [ 'label' => esc_html__( 'Offset', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -1000, 'max' => 1000, ], '%' => [ 'min' => -200, 'max' => 200, ], 'vh' => [ 'min' => -200, 'max' => 200, ], 'vw' => [ 'min' => -200, 'max' => 200, ], ], 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'vw', 'custom' ], 'default' => [ 'size' => 0, ], 'selectors' => [ '{{WRAPPER}}' => 'top: {{SIZE}}{{UNIT}}', ], 'condition' => [ '_offset_orientation_v!' => 'end', 'position!' => '', ], ] ); $this->add_responsive_control( '_offset_y_end', [ 'label' => esc_html__( 'Offset', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -1000, 'max' => 1000, ], '%' => [ 'min' => -200, 'max' => 200, ], 'vh' => [ 'min' => -200, 'max' => 200, ], 'vw' => [ 'min' => -200, 'max' => 200, ], ], 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'vw', 'custom' ], 'default' => [ 'size' => 0, ], 'selectors' => [ '{{WRAPPER}}' => 'bottom: {{SIZE}}{{UNIT}}', ], 'condition' => [ '_offset_orientation_v' => 'end', 'position!' => '', ], ] ); $this->add_responsive_control( 'z_index', [ 'label' => esc_html__( 'Z-Index', 'elementor' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'selectors' => [ '{{WRAPPER}}' => '--z-index: {{VALUE}};', ], ] ); $this->add_control( '_element_id', [ 'label' => esc_html__( 'CSS ID', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'ai' => [ 'active' => false, ], 'dynamic' => [ 'active' => true, ], 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ), 'style_transfer' => false, 'classes' => 'elementor-control-direction-ltr', ] ); $this->add_control( 'css_classes', [ 'label' => esc_html__( 'CSS Classes', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'ai' => [ 'active' => false, ], 'dynamic' => [ 'active' => true, ], 'prefix_class' => '', 'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ), 'classes' => 'elementor-control-direction-ltr', ] ); Plugin::$instance->controls_manager->add_display_conditions_controls( $this ); $this->end_controls_section(); } /** * Register the Container's motion effects controls. * * @return void */ protected function register_motion_effects_controls() { $this->start_controls_section( 'section_effects', [ 'label' => esc_html__( 'Motion Effects', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); Plugin::$instance->controls_manager->add_motion_effects_promotion_control( $this ); $this->add_responsive_control( 'animation', [ 'label' => esc_html__( 'Entrance Animation', 'elementor' ), 'type' => Controls_Manager::ANIMATION, 'frontend_available' => true, ] ); $this->add_control( 'animation_duration', [ 'label' => esc_html__( 'Animation Duration', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ 'slow' => esc_html__( 'Slow', 'elementor' ), '' => esc_html__( 'Normal', 'elementor' ), 'fast' => esc_html__( 'Fast', 'elementor' ), ], 'prefix_class' => 'animated-', 'condition' => [ 'animation!' => '', ], ] ); $this->add_control( 'animation_delay', [ 'label' => esc_html__( 'Animation Delay', 'elementor' ) . ' (ms)', 'type' => Controls_Manager::NUMBER, 'default' => '', 'min' => 0, 'step' => 100, 'condition' => [ 'animation!' => '', ], 'render_type' => 'none', 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register the Container's responsive controls. * * @return void */ protected function register_responsive_controls() { $this->start_controls_section( '_section_responsive', [ 'label' => esc_html__( 'Responsive', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->add_control( 'heading_visibility', [ 'label' => esc_html__( 'Visibility', 'elementor' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'responsive_description', [ 'raw' => sprintf( /* translators: 1: Link open tag, 2: Link close tag. */ 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' ), '', '' ), 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-descriptor', ] ); $this->add_hidden_device_controls(); $this->end_controls_section(); } /** * Register the Container's advanced tab. * * @return void */ protected function register_advanced_tab() { $this->register_advanced_controls(); $this->register_motion_effects_controls(); $this->hook_sticky_notice_into_transform_section(); $this->register_transform_section( 'con' ); $this->register_responsive_controls(); Plugin::$instance->controls_manager->add_custom_attributes_controls( $this ); Plugin::$instance->controls_manager->add_custom_css_controls( $this ); } protected function hook_sticky_notice_into_transform_section() { add_action( 'elementor/element/container/_section_transform/after_section_start', function( Container $container ) { if ( ! empty( $container->get_controls( 'transform_sticky_notice' ) ) ) { return; } $container->add_control( 'transform_sticky_notice', [ 'type' => Controls_Manager::ALERT, 'alert_type' => 'warning', 'content' => esc_html__( 'Note: Avoid applying transform properties on sticky containers. Doing so might cause unexpected results.', 'elementor' ), ] ); } ); } /** * Register the Container's controls. * * @return void */ protected function register_controls() { $this->register_layout_tab(); $this->register_style_tab(); $this->register_advanced_tab(); } public function on_import( $element ) { return self::slider_to_gaps_converter( $element ); } /** * Convert slider to gaps control for the 3.16 upgrade script * * @param array $element * @return array */ public static function slider_to_gaps_converter( $element ) { $breakpoints = array_keys( (array) Plugin::$instance->breakpoints->get_breakpoints() ); $breakpoints[] = 'desktop'; $control_name = 'flex_gap'; foreach ( $breakpoints as $breakpoint ) { $control = 'desktop' !== $breakpoint ? $control_name . '_' . $breakpoint : $control_name; if ( ! isset( $element['settings'][ $control ] ) ) { continue; } $already_using_gaps_control = isset( $element['settings'][ $control ]['isLinked'] ); // Slider control won't have the 'isLinked' property. if ( ! $already_using_gaps_control ) { $old_size = strval( $element['settings'][ $control ]['size'] ); $element['settings'][ $control ]['column'] = $old_size; $element['settings'][ $control ]['row'] = $old_size; $element['settings'][ $control ]['isLinked'] = true; } } return $element; } }