* @copyright 2007-2022 Leotheme * @license http://leotheme.com - prestashop template provider */ namespace LeoElements; use LeoElements\Leo_Helper; if ( ! defined( '_PS_VERSION_' ) ) { exit; // Exit if accessed directly. } /** * Elementor section element. * * Elementor section handler class is responsible for initializing the section * element. * * @since 1.0.0 */ class Element_Section extends Element_Base { /** * Section predefined columns presets. * * Holds the predefined columns width for each columns count available by * default by Elementor. Default is an empty array. * * Note that when the user creates a section he can define custom sizes for * the columns. But Elementor sets default values for predefined columns. * * For example two columns 50% width each one, or three columns 33.33% each * one. This property hold the data for those preset values. * * @since 1.0.0 * @access private * @static * * @var array Section presets. */ private static $presets = []; /** * Get element type. * * Retrieve the element type, in this case `section`. * * @since 1.0.0 * @access public * @static * * @return string The type. */ public static function get_type() { return 'section'; } /** * Get section name. * * Retrieve the section name. * * @since 1.0.0 * @access public * * @return string Section name. */ public function get_name() { return 'section'; } /** * Get section title. * * Retrieve the section title. * * @since 1.0.0 * @access public * * @return string Section title. */ public function get_title() { return Leo_Helper::__( 'Section', 'elementor' ); } /** * Get section icon. * * Retrieve the section icon. * * @since 1.0.0 * @access public * * @return string Section icon. */ public function get_icon() { return 'eicon-columns'; } /** * Get presets. * * Retrieve a specific preset columns for a given columns count, or a list * of all the preset if no parameters passed. * * @since 1.0.0 * @access public * @static * * @param int $columns_count Optional. Columns count. Default is null. * @param int $preset_index Optional. Preset index. Default is null. * * @return array Section presets. */ public static function get_presets( $columns_count = null, $preset_index = null ) { if ( ! self::$presets ) { self::init_presets(); } $presets = self::$presets; if ( null !== $columns_count ) { $presets = $presets[ $columns_count ]; } if ( null !== $preset_index ) { $presets = $presets[ $preset_index ]; } return $presets; } /** * Initialize presets. * * Initializing the section presets and set the number of columns the * section can have by default. For example a column can have two columns * 50% width each one, or three columns 33.33% each one. * * Note that Elementor sections have default section presets but the user * can set custom number of columns and define custom sizes for each column. * @since 1.0.0 * @access public * @static */ public static function init_presets() { $additional_presets = [ 2 => [ [ 'preset' => [ 33, 66 ], ], [ 'preset' => [ 66, 33 ], ], ], 3 => [ [ 'preset' => [ 25, 25, 50 ], ], [ 'preset' => [ 50, 25, 25 ], ], [ 'preset' => [ 25, 50, 25 ], ], [ 'preset' => [ 16, 66, 16 ], ], ], ]; foreach ( range( 1, 10 ) as $columns_count ) { self::$presets[ $columns_count ] = [ [ 'preset' => [], ], ]; $preset_unit = floor( 1 / $columns_count * 100 ); for ( $i = 0; $i < $columns_count; $i++ ) { self::$presets[ $columns_count ][0]['preset'][] = $preset_unit; } if ( ! empty( $additional_presets[ $columns_count ] ) ) { self::$presets[ $columns_count ] = array_merge( self::$presets[ $columns_count ], $additional_presets[ $columns_count ] ); } foreach ( self::$presets[ $columns_count ] as $preset_index => & $preset ) { $preset['key'] = $columns_count . $preset_index; } } } /** * Get initial config. * * Retrieve the current section initial configuration. * * Adds more configuration on top of the controls list, the tabs assigned to * the control, element name, type, icon and more. This method also adds * section presets. * * @since 1.0.10 * @access protected * * @return array The initial config. */ protected function _get_initial_config() { $config = parent::_get_initial_config(); $config['presets'] = self::get_presets(); $config['controls'] = $this->get_controls(); $config['tabs_controls'] = $this->get_tabs_controls(); return $config; } /** * Register section controls. * * Used to add new controls to the section element. * * @since 1.0.0 * @access protected */ protected function _register_controls() { $this->start_controls_section( 'section_layout', [ 'label' => Leo_Helper::__( 'Layout', 'elementor' ), 'tab' => Controls_Manager::TAB_LAYOUT, ] ); $this->add_control( '_title', [ 'label' => Leo_Helper::__( 'Title', 'elementor' ), 'type' => Controls_Manager::HIDDEN, 'render_type' => 'none', ] ); $this->add_control( 'stretch_section', [ 'label' => Leo_Helper::__( 'Stretch Section', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'section-stretched', 'prefix_class' => 'elementor-', 'hide_in_inner' => true, 'description' => Leo_Helper::__( 'Stretch the section to the full width of the page using JS.', 'elementor' ) . sprintf( ' %2$s', 'https://subdomain.leoelements.com/stretch-section/', Leo_Helper::__( 'Learn more.', 'elementor' ) ), 'render_type' => 'none', 'frontend_available' => true, ] ); $this->add_control( 'layout', [ 'label' => Leo_Helper::__( 'Content Width', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'boxed', 'options' => [ 'boxed' => Leo_Helper::__( 'Boxed', 'elementor' ), 'full_width' => Leo_Helper::__( 'Full Width', 'elementor' ), ], 'prefix_class' => 'elementor-section-', ] ); $this->add_control( 'content_width', [ 'label' => Leo_Helper::__( 'Content Width', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 500, 'max' => 1600, ], ], 'selectors' => [ '{{WRAPPER}} > .elementor-container' => 'max-width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'layout' => [ 'boxed' ], ], 'show_label' => false, 'separator' => 'none', ] ); $this->add_control( 'gap', [ 'label' => Leo_Helper::__( 'Columns Gap', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => Leo_Helper::__( 'Default', 'elementor' ), 'no' => Leo_Helper::__( 'No Gap', 'elementor' ), 'narrow' => Leo_Helper::__( 'Narrow', 'elementor' ), 'extended' => Leo_Helper::__( 'Extended', 'elementor' ), 'wide' => Leo_Helper::__( 'Wide', 'elementor' ), 'wider' => Leo_Helper::__( 'Wider', 'elementor' ), 'custom' => Leo_Helper::__( 'Custom', 'elementor' ), ], ] ); $this->add_responsive_control( 'gap_columns_custom', [ 'label' => Leo_Helper::__( 'Custom Columns Gap', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], '%' => [ 'min' => 0, 'max' => 100, ], 'vh' => [ 'min' => 0, 'max' => 100, ], 'vw' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%', 'vh', 'vw' ], 'selectors' => [ '{{WRAPPER}} .elementor-column-gap-custom .elementor-column > .elementor-element-populated' => 'padding: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'gap' => 'custom', ], ] ); $this->add_control( 'height', [ 'label' => Leo_Helper::__( 'Height', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => Leo_Helper::__( 'Default', 'elementor' ), 'full' => Leo_Helper::__( 'Fit To Screen', 'elementor' ), 'min-height' => Leo_Helper::__( 'Min Height', 'elementor' ), ], 'prefix_class' => 'elementor-section-height-', 'hide_in_inner' => true, ] ); $this->add_responsive_control( 'custom_height', [ 'label' => Leo_Helper::__( 'Minimum Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 400, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1440, ], 'vh' => [ 'min' => 0, 'max' => 100, ], 'vw' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', 'vh', 'vw' ], 'selectors' => [ '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'height' => [ 'min-height' ], ], 'hide_in_inner' => true, ] ); $this->add_control( 'height_inner', [ 'label' => Leo_Helper::__( 'Height', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => Leo_Helper::__( 'Default', 'elementor' ), 'min-height' => Leo_Helper::__( 'Min Height', 'elementor' ), ], 'prefix_class' => 'elementor-section-height-inner-', 'hide_in_top' => true, ] ); $this->add_responsive_control( 'custom_height_inner', [ 'label' => Leo_Helper::__( 'Minimum Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 400, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1440, ], ], 'selectors' => [ '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'height_inner' => [ 'min-height' ], ], 'hide_in_top' => true, ] ); $this->add_control( 'column_position', [ 'label' => Leo_Helper::__( 'Column Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'middle', 'options' => [ 'stretch' => Leo_Helper::__( 'Stretch', 'elementor' ), 'top' => Leo_Helper::__( 'Top', 'elementor' ), 'middle' => Leo_Helper::__( 'Middle', 'elementor' ), 'bottom' => Leo_Helper::__( 'Bottom', 'elementor' ), ], 'prefix_class' => 'elementor-section-items-', 'condition' => [ 'height' => [ 'full', 'min-height' ], ], ] ); $this->add_control( 'content_position', [ 'label' => Leo_Helper::__( 'Content Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => Leo_Helper::__( 'Default', 'elementor' ), 'top' => Leo_Helper::__( 'Top', 'elementor' ), 'middle' => Leo_Helper::__( 'Middle', 'elementor' ), 'bottom' => Leo_Helper::__( 'Bottom', 'elementor' ), 'space-between' => Leo_Helper::__( 'Space Between', 'elementor' ), 'space-around' => Leo_Helper::__( 'Space Around', 'elementor' ), 'space-evenly' => Leo_Helper::__( 'Space Evenly', 'elementor' ), ], 'selectors_dictionary' => [ 'top' => 'flex-start', 'middle' => 'center', 'bottom' => 'flex-end', ], 'selectors' => [ '{{WRAPPER}} > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap > .elementor-widget-wrap' => 'align-content: {{VALUE}}; align-items: {{VALUE}};', ], // TODO: The following line is for BC since 2.7.0 'prefix_class' => 'elementor-section-content-', ] ); $this->add_control( 'overflow', [ 'label' => Leo_Helper::__( 'Overflow', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => Leo_Helper::__( 'Default', 'elementor' ), 'hidden' => Leo_Helper::__( 'Hidden', 'elementor' ), ], 'selectors' => [ '{{WRAPPER}}' => 'overflow: {{VALUE}}', ], ] ); $possible_tags = [ 'div', 'header', 'footer', 'main', 'article', 'section', 'aside', 'nav', ]; $options = [ '' => Leo_Helper::__( 'Default', 'elementor' ), ] + array_combine( $possible_tags, $possible_tags ); $this->add_control( 'html_tag', [ 'label' => Leo_Helper::__( 'HTML Tag', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => $options, 'separator' => 'before', ] ); $this->add_control( 'structure', [ 'label' => Leo_Helper::__( 'Structure', 'elementor' ), 'type' => Controls_Manager::STRUCTURE, 'default' => '10', 'render_type' => 'none', ] ); $this->end_controls_section(); // Section background $this->start_controls_section( 'section_background', [ 'label' => Leo_Helper::__( 'Background', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_background' ); $this->start_controls_tab( 'tab_background_normal', [ 'label' => Leo_Helper::__( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'background', 'types' => [ 'classic', 'gradient', 'video' ], 'fields_options' => [ 'background' => [ 'frontend_available' => true, ], 'video_link' => [ 'frontend_available' => true, ], 'video_start' => [ 'frontend_available' => true, ], 'video_end' => [ 'frontend_available' => true, ], 'play_once' => [ 'frontend_available' => true, ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_background_hover', [ 'label' => Leo_Helper::__( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'background_hover', 'selector' => '{{WRAPPER}}:hover', ] ); $this->add_control( 'background_hover_transition', [ 'label' => Leo_Helper::__( 'Transition Duration', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.3, ], 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'render_type' => 'ui', 'separator' => 'before', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); // Background Overlay $this->start_controls_section( 'section_background_overlay', [ 'label' => Leo_Helper::__( 'Background Overlay', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_background_overlay' ); $this->start_controls_tab( 'tab_background_overlay_normal', [ 'label' => Leo_Helper::__( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'background_overlay', 'selector' => '{{WRAPPER}} > .elementor-background-overlay', ] ); $this->add_control( 'background_overlay_opacity', [ 'label' => Leo_Helper::__( 'Opacity', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => .5, ], 'range' => [ 'px' => [ 'max' => 1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} > .elementor-background-overlay' => 'opacity: {{SIZE}};', ], 'condition' => [ 'background_overlay_background' => [ 'classic', 'gradient' ], ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters', 'selector' => '{{WRAPPER}} .elementor-background-overlay', 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'background_overlay_image[url]', 'operator' => '!==', 'value' => '', ], [ 'name' => 'background_overlay_color', 'operator' => '!==', 'value' => '', ], ], ], ] ); $this->add_control( 'overlay_blend_mode', [ 'label' => Leo_Helper::__( 'Blend Mode', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => Leo_Helper::__( 'Normal', 'elementor' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'saturation' => 'Saturation', 'color' => 'Color', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} > .elementor-background-overlay' => 'mix-blend-mode: {{VALUE}}', ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'background_overlay_image[url]', 'operator' => '!==', 'value' => '', ], [ 'name' => 'background_overlay_color', 'operator' => '!==', 'value' => '', ], ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_background_overlay_hover', [ 'label' => Leo_Helper::__( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'background_overlay_hover', 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay', ] ); $this->add_control( 'background_overlay_hover_opacity', [ 'label' => Leo_Helper::__( 'Opacity', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => .5, ], 'range' => [ 'px' => [ 'max' => 1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}}:hover > .elementor-background-overlay' => 'opacity: {{SIZE}};', ], 'condition' => [ 'background_overlay_hover_background' => [ 'classic', 'gradient' ], ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters_hover', 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay', ] ); $this->add_control( 'background_overlay_hover_transition', [ 'label' => Leo_Helper::__( 'Transition Duration', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.3, ], 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'render_type' => 'ui', 'separator' => 'before', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); // Section border $this->start_controls_section( 'section_border', [ 'label' => Leo_Helper::__( 'Border', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_border' ); $this->start_controls_tab( 'tab_border_normal', [ 'label' => Leo_Helper::__( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'border', ] ); $this->add_responsive_control( 'border_radius', [ 'label' => Leo_Helper::__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}}, {{WRAPPER}} > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_border_hover', [ 'label' => Leo_Helper::__( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'border_hover', 'selector' => '{{WRAPPER}}:hover', ] ); $this->add_responsive_control( 'border_radius_hover', [ 'label' => Leo_Helper::__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}}:hover, {{WRAPPER}}:hover > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow_hover', 'selector' => '{{WRAPPER}}:hover', ] ); $this->add_control( 'border_hover_transition', [ 'label' => Leo_Helper::__( 'Transition Duration', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'separator' => 'before', 'default' => [ 'size' => 0.3, ], 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'background_background', 'operator' => '!==', 'value' => '', ], [ 'name' => 'border_border', 'operator' => '!==', 'value' => '', ], ], ], 'selectors' => [ '{{WRAPPER}}' => 'transition: background {{background_hover_transition.SIZE}}s, border {{SIZE}}s, border-radius {{SIZE}}s, box-shadow {{SIZE}}s', '{{WRAPPER}} > .elementor-background-overlay' => 'transition: background {{background_overlay_hover_transition.SIZE}}s, border-radius {{SIZE}}s, opacity {{background_overlay_hover_transition.SIZE}}s', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); // Section Shape Divider $this->start_controls_section( 'section_shape_divider', [ 'label' => Leo_Helper::__( 'Shape Divider', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_shape_dividers' ); $shapes_options = [ '' => Leo_Helper::__( 'None', 'elementor' ), ]; foreach ( Shapes::get_shapes() as $shape_name => $shape_props ) { $shapes_options[ $shape_name ] = $shape_props['title']; } foreach ( [ 'top' => Leo_Helper::__( 'Top', 'elementor' ), 'bottom' => Leo_Helper::__( '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' => Leo_Helper::__( 'Type', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => $shapes_options, 'render_type' => 'none', 'frontend_available' => true, ] ); $this->add_control( $base_control_key . '_color', [ 'label' => Leo_Helper::__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'condition' => [ "shape_divider_$side!" => '', ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side .elementor-shape-fill" => 'fill: {{UNIT}};', ], ] ); $this->add_responsive_control( $base_control_key . '_width', [ 'label' => Leo_Helper::__( 'Width', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'range' => [ '%' => [ 'min' => 100, 'max' => 300, ], ], 'condition' => [ "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'height_only', Shapes::FILTER_EXCLUDE ) ), ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg" => 'width: calc({{SIZE}}{{UNIT}} + 1.3px)', ], ] ); $this->add_responsive_control( $base_control_key . '_height', [ 'label' => Leo_Helper::__( 'Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 500, ], ], 'condition' => [ "shape_divider_$side!" => '', ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg" => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( $base_control_key . '_flip', [ 'label' => Leo_Helper::__( 'Flip', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'condition' => [ "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_flip' ) ), ], 'selectors' => [ "{{WRAPPER}} > .elementor-shape-$side svg" => 'transform: translateX(-50%) rotateY(180deg)', ], ] ); $this->add_control( $base_control_key . '_negative', [ 'label' => Leo_Helper::__( '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' => Leo_Helper::__( 'Bring to Front', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'selectors' => [ "{{WRAPPER}} > .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(); // Section Typography $this->start_controls_section( 'section_typo', [ 'label' => Leo_Helper::__( 'Typography', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); if ( in_array( Scheme_Color::get_type(), Schemes_Manager::get_enabled_schemes(), true ) ) { $this->add_control( 'colors_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => Leo_Helper::__( 'Note: The following colors won\'t work if Default Colors are enabled.', 'elementor' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', ] ); } $this->add_control( 'heading_color', [ 'label' => Leo_Helper::__( 'Heading Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};', ], 'separator' => 'none', ] ); $this->add_control( 'color_text', [ 'label' => Leo_Helper::__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}}' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'color_link', [ 'label' => Leo_Helper::__( 'Link Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} a' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'color_link_hover', [ 'label' => Leo_Helper::__( 'Link Hover Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} a:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'text_align', [ 'label' => Leo_Helper::__( 'Text Align', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => Leo_Helper::__( 'Left', 'elementor' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => Leo_Helper::__( 'Center', 'elementor' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => Leo_Helper::__( 'Right', 'elementor' ), 'icon' => 'eicon-text-align-right', ], ], 'selectors' => [ '{{WRAPPER}} > .elementor-container' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_section(); // Section Advanced $this->start_controls_section( 'section_advanced', [ 'label' => Leo_Helper::__( 'Advanced', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->add_responsive_control( 'margin', [ 'label' => Leo_Helper::__( 'Margin', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'allowed_dimensions' => 'vertical', 'placeholder' => [ 'top' => '', 'right' => 'auto', 'bottom' => '', 'left' => 'auto', ], 'selectors' => [ '{{WRAPPER}}' => 'margin-top: {{TOP}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'padding', [ 'label' => Leo_Helper::__( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'z_index', [ 'label' => Leo_Helper::__( 'Z-Index', 'elementor' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'selectors' => [ '{{WRAPPER}}' => 'z-index: {{VALUE}};', ], 'label_block' => false, ] ); $this->add_control( '_element_id', [ 'label' => Leo_Helper::__( 'CSS ID', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'title' => Leo_Helper::__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ), 'label_block' => false, 'style_transfer' => false, 'classes' => 'elementor-control-direction-ltr', ] ); $this->add_control( 'css_classes', [ 'label' => Leo_Helper::__( 'CSS Classes', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'prefix_class' => '', 'title' => Leo_Helper::__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ), 'label_block' => false, 'classes' => 'elementor-control-direction-ltr', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_effects', [ 'label' => Leo_Helper::__( 'Motion Effects', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->add_responsive_control( 'animation', [ 'label' => Leo_Helper::__( 'Entrance Animation', 'elementor' ), 'type' => Controls_Manager::ANIMATION, 'frontend_available' => true, ] ); $this->add_control( 'animation_duration', [ 'label' => Leo_Helper::__( 'Animation Duration', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ 'slow' => Leo_Helper::__( 'Slow', 'elementor' ), '' => Leo_Helper::__( 'Normal', 'elementor' ), 'fast' => Leo_Helper::__( 'Fast', 'elementor' ), ], 'prefix_class' => 'animated-', 'condition' => [ 'animation!' => '', ], ] ); $this->add_control( 'animation_delay', [ 'label' => Leo_Helper::__( '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(); // Section Responsive $this->start_controls_section( '_section_responsive', [ 'label' => Leo_Helper::__( 'Responsive', 'elementor' ), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->add_control( 'reverse_order_tablet', [ 'label' => Leo_Helper::__( 'Reverse Columns', 'elementor' ) . ' (' . Leo_Helper::__( 'Tablet', 'elementor' ) . ')', 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'elementor-', 'return_value' => 'reverse-tablet', ] ); $this->add_control( 'reverse_order_mobile', [ 'label' => Leo_Helper::__( 'Reverse Columns', 'elementor' ) . ' (' . Leo_Helper::__( 'Mobile', 'elementor' ) . ')', 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'elementor-', 'return_value' => 'reverse-mobile', ] ); $this->add_control( 'heading_visibility', [ 'label' => Leo_Helper::__( 'Visibility', 'elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'responsive_description', [ 'raw' => Leo_Helper::__( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ), 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-descriptor', ] ); $this->add_control( 'hide_desktop', [ 'label' => Leo_Helper::__( 'Hide On Desktop', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'elementor-', 'label_on' => Leo_Helper::__( 'Hide', 'elementor' ), 'label_off' => Leo_Helper::__( 'Show', 'elementor' ), 'return_value' => 'hidden-desktop', ] ); $this->add_control( 'hide_tablet', [ 'label' => Leo_Helper::__( 'Hide On Tablet', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'elementor-', 'label_on' => Leo_Helper::__( 'Hide', 'elementor' ), 'label_off' => Leo_Helper::__( 'Show', 'elementor' ), 'return_value' => 'hidden-tablet', ] ); $this->add_control( 'hide_mobile', [ 'label' => Leo_Helper::__( 'Hide On Mobile', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'elementor-', 'label_on' => Leo_Helper::__( 'Hide', 'elementor' ), 'label_off' => Leo_Helper::__( 'Show', 'elementor' ), 'return_value' => 'hidden-phone', ] ); $this->end_controls_section(); Plugin::$instance->controls_manager->add_custom_attributes_controls( $this ); Plugin::$instance->controls_manager->add_custom_css_controls( $this ); } /** * Render section output in the editor. * * Used to generate the live preview, using a Backbone JavaScript template. * * @since 1.0.0 * @access protected */ protected function _content_template() { ?> <# if ( settings.background_video_link ) { let videoAttributes = 'autoplay muted playsinline'; if ( ! settings.background_play_once ) { videoAttributes += ' loop'; } #>