start_controls_section( 'image', [ 'label' => __( 'Image', 'wts-eae' ), ] ); $this->add_control( 'compare_style', [ 'label' => __( 'Compare Style', 'wts-eae' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'horizontal' => __( 'Horizontal', 'wts-eae' ), 'vertical' => __( 'Vertical', 'wts-eae' ), ], 'default' => 'horizontal', ] ); $this->add_control( 'slider_position', [ 'label' => __( 'Slider Position', 'wts-eae' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ '%' => [ 'min' => 0, 'max' => 90, ], ], ] ); $this->add_control( 'slider_icon_new', [ 'label' => __( 'Icon', 'wts-eae' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'slider_icon', 'default' => [ 'value' => 'fas fa-star', 'library' => 'fa-solid', ], ] ); $this->add_control( 'before_image', [ 'label' => __( 'Before Image', 'wts-eae' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'show_label' => true, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'before_image_size', // Actually its `image_size` 'default' => 'medium_large', ] ); $this->add_control( 'image_head', [ 'label' => __( 'heading', 'wts-eae' ), 'show_label' => false, 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'after_image', [ 'label' => __( 'After Image', 'wts-eae' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'selectors' => [], 'show_label' => true, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'after_image_size', // Actually its `image_size` 'default' => 'medium_large', ] ); $this->add_control( 'separator_text', [ 'label' => __( 'heading', 'wts-eae' ), 'show_label' => false, 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'text_before', [ 'label' => __( 'Before Text', 'wts-eae' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'placeholder' => __( 'Enter text', 'wts-eae' ), 'default' => __( 'BEFORE', 'wts-eae' ), ] ); $this->add_control( 'text_after', [ 'label' => __( 'After Text', 'wts-eae' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'placeholder' => __( 'Enter text', 'wts-eae' ), 'default' => __( 'AFTER', 'wts-eae' ), ] ); $this->end_controls_section(); $this->start_controls_section( 'image_style', [ 'label' => __( 'General', 'wts-eae' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'icon_size', [ 'label' => __( 'Icon Size', 'wts-eae' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 22, ], 'render_type' => 'template', 'range' => [ 'px' => [ 'min' => 3, 'max' => 60, ], ], 'selectors' => [ '{{WRAPPER}} .eae-slider-icon' => 'font-size: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .eae-img-comp-slider' => 'padding: {{size}}{{UNIT}};', '{{WRAPPER}} .eae-img-comp-slider svg' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'slider_icon_color', [ 'label' => __( 'Icon Color', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .eae-slider-icon' => 'color: {{VALUE}}', '{{WRAPPER}} .eae-img-comp-slider svg' => 'fill: {{VALUE}}', ], ] ); $this->add_control( 'slider_bg_color', [ 'label' => __( 'Slider Color', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eae-img-comp-slider' => 'background-color: {{VALUE}} !important', ], ] ); $this->add_control( 'separator_color', [ 'label' => __( 'Separator Color', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eae-img-comp-overlay' => 'border-color: {{VALUE}}', ], ] ); $this->add_control( 'separator_alignment', [ 'label' => __( 'Separator Alignment', 'wts-eae' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ '%' => [ 'min' => 0, 'max' => 90, ], ], 'selectors' => [ '{{WRAPPER}} .mode-horizontal .eae-img-comp-slider' => 'top: {{SIZE}}% !important;', '{{WRAPPER}} .mode-vertical .eae-img-comp-slider' => 'left: {{SIZE}}% !important;', ], ] ); $this->add_control( 'slider_separator_width', [ 'label' => __( 'Separator Width', 'wts-eae' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 0, 'max' => 10, 'step' => 1, 'render_type' => 'template', 'selectors' => [ '{{WRAPPER}} .mode-horizontal .eae-img-comp-overlay' => ' border-right-style:solid; border-right-width: {{SIZE}}px;', '{{WRAPPER}} .mode-vertical .eae-img-comp-overlay' => ' border-bottom-style:solid; border-bottom-width: {{SIZE}}px;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'label_style', [ 'label' => __( 'Label', 'wts-eae' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'label_position_horizontal', [ 'label' => __( 'Position', 'wts-eae' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'top' => __( 'Top', 'wts-eae' ), 'bottom' => __( 'Bottom', 'wts-eae' ), ], 'condition' => [ 'compare_style' => 'horizontal', ], 'default' => 'top', 'prefix_class' => 'eae-label-pos-', 'selectors' => [ '{{WRAPPER}}.eae-label-pos-top .eae-text-after' => 'top: 0px;left:0px', '{{WRAPPER}}.eae-label-pos-top .eae-text-before' => 'top: 0px;right:0px', '{{WRAPPER}}.eae-label-pos-bottom .eae-text-after' => 'bottom: 10px;left:0px', '{{WRAPPER}}.eae-label-pos-bottom .eae-text-before' => 'bottom: 10px;right:0px', ], ] ); $this->add_control( 'label_position_vertical', [ 'label' => __( 'Position', 'wts-eae' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'left' => __( 'Left', 'wts-eae' ), 'right' => __( 'Right', 'wts-eae' ), ], 'condition' => [ 'compare_style' => 'vertical', ], 'default' => 'left', 'prefix_class' => 'eae-label-pos-', 'selectors' => [ '{{WRAPPER}}.eae-label-pos-left .eae-text-after' => 'top: 0px;left:0px;', '{{WRAPPER}}.eae-label-pos-left .eae-text-before' => 'bottom: 0px;right:0px;', '{{WRAPPER}}.eae-label-pos-right .eae-text-after' => 'top: 0px;right:0px;', '{{WRAPPER}}.eae-label-pos-right .eae-text-before' => 'bottom: 0px; left:0px;', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'label_text_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .eae-text-after, {{WRAPPER}} .eae-text-before', ] ); $this->add_control( 'label_color', [ 'label' => __( 'Color', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .eae-text-after' => 'color: {{VALUE}}', '{{WRAPPER}} .eae-text-before' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'label_background_color', [ 'label' => __( 'BackgroundColor', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eae-text-after' => 'background-color: {{VALUE}}', '{{WRAPPER}} .eae-text-before' => 'background-color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'label_border', 'label' => __( 'Box Border', 'wts-eae' ), 'selector' => '{{WRAPPER}} .eae-text-after, {{WRAPPER}} .eae-text-before', ] ); $this->add_control( 'label_border_radius', [ 'label' => __( 'Border Radius', 'wts-eae' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .eae-text-after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .eae-text-before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'label_padding', [ 'label' => __( 'Padding', 'wts-eae' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .eae-text-after' => 'padding: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', '{{WRAPPER}} .eae-text-before' => 'padding: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->add_control( 'label_margin', [ 'label' => __( 'Margin', 'wts-eae' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .eae-text-after' => 'margin: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', '{{WRAPPER}} .eae-text-before' => 'margin: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'wrapper', 'class', 'eae-img-comp-container' ); $this->add_render_attribute( 'wrapper', 'class', 'mode-' . $settings['compare_style'] ); $this->add_render_attribute( 'wrapper', 'data-ab-style', $settings['compare_style'] ); $this->add_render_attribute( 'wrapper', 'data-slider-pos', $settings['slider_position']['size'] ); $this->add_render_attribute( 'icon', 'class', 'icon-' . $settings['compare_style'] ); $this->add_render_attribute( 'icon', 'class', 'eae-img-comp-slider' ); $icon_migrated = isset( $settings['__fa4_migrated']['slider_icon_new'] ); $icon_is_new = empty( $settings['slider_icon'] ); $attr = []; $attr = [ 'data-skip-lazy' => true ]; ?>