'container', 'settings' => [ '_title' => __( 'Slide #1', 'elementor-pro' ), ], ], [ 'elType' => 'container', 'settings' => [ '_title' => __( 'Slide #2', 'elementor-pro' ), ], ], [ 'elType' => 'container', 'settings' => [ '_title' => __( 'Slide #3', 'elementor-pro' ), ], ], ]; } protected function get_default_repeater_title_setting_key() { return 'slide_title'; } protected function get_default_children_title() { return esc_html__( 'Slide #%d', 'elementor-pro' ); } protected function get_default_children_placeholder_selector() { return '.swiper-wrapper'; } protected function get_html_wrapper_class() { return 'elementor-widget-n-carousel'; } protected function register_controls() { $low_specificity_slider_container_selector = ':where( {{WRAPPER}} .swiper-slide ) > .e-con'; $this->start_controls_section( 'section_slides', [ 'label' => esc_html__( 'Slides', 'elementor-pro' ), ] ); $repeater = new Repeater(); $repeater->add_control( 'slide_title', [ 'label' => esc_html__( 'Title', 'elementor-pro' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Slide Title', 'elementor-pro' ), 'placeholder' => esc_html__( 'Slide Title', 'elementor-pro' ), 'dynamic' => [ 'active' => true, ], 'label_block' => true, ] ); $this->add_control( 'carousel_items', [ 'label' => esc_html__( 'Carousel Items', 'elementor-pro' ), 'type' => Control_Nested_Repeater::CONTROL_TYPE, 'fields' => $repeater->get_controls(), 'default' => [ [ 'slide_title' => esc_html__( 'Slide #1', 'elementor-pro' ), ], [ 'slide_title' => esc_html__( 'Slide #2', 'elementor-pro' ), ], [ 'slide_title' => esc_html__( 'Slide #3', 'elementor-pro' ), ], ], 'frontend_available' => true, 'title_field' => '{{{ slide_title }}}', ] ); $this->add_carousel_layout_controls( [ 'css_prefix' => 'e-n-carousel-', 'slides_to_show_custom_settings' => [ 'separator' => 'before', 'tablet_default' => '2', 'mobile_default' => '1', 'frontend_available' => true, 'render_type' => 'template', 'selectors' => [ '{{WRAPPER}}' => '--e-n-carousel-swiper-slides-to-display: {{VALUE}}', ], ], 'slides_to_scroll_custom_settings' => [], 'equal_height_custom_settings' => [ 'selectors' => [ '{{WRAPPER}}' => '--e-n-carousel-slide-height: auto; --e-n-carousel-slide-container-height: 100%;', ], ], 'slides_on_display' => 8, ] ); $this->end_controls_section(); $this->add_carousel_settings_controls( [ 'css_prefix' => 'e-n-carousel-', 'autoplay_custom_settings' => [ 'description' => esc_html__( 'The Autoplay is inactive while editing. Preview your page to see it in action.', 'elementor-pro' ), ], 'infinite_custom_settings' => [ 'description' => esc_html__( 'Infinite scroll is inactive while editing. Preview your page to see it in action.', 'elementor-pro' ), ], 'offset_sides_custom_settings' => [ 'description' => esc_html__( 'Offset is inactive while editing. Preview your page to see it in action.', 'elementor-pro' ), ], ] ); $this->add_carousel_navigation_controls( [ 'css_prefix' => 'e-n-carousel-', ] ); $this->add_carousel_pagination_controls( [ 'css_prefix' => 'e-n-carousel-', ] ); $this->start_controls_section( 'section_slides_style', [ 'label' => esc_html__( 'Slides', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_spacing_custom', [ 'label' => esc_html__( 'Gap between slides', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 400, ], 'em' => [ 'max' => 40, ], 'rem' => [ 'max' => 40, ], ], 'default' => [ 'size' => 10, ], 'frontend_available' => true, 'render_type' => 'none', 'selectors' => [ '{{WRAPPER}}' => '--e-n-carousel-swiper-slides-gap: {{SIZE}}{{UNIT}}', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'content_background', 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => $low_specificity_slider_container_selector, 'fields_options' => [ 'color' => [ 'label' => esc_html__( 'Background Color', 'elementor-pro' ), ], ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'content_border', 'selector' => $low_specificity_slider_container_selector, 'fields_options' => [ 'color' => [ 'label' => esc_html__( 'Border Color', 'elementor-pro' ), ], 'width' => [ 'label' => esc_html__( 'Border Width', 'elementor-pro' ), ], ], ] ); $this->add_responsive_control( 'border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $low_specificity_slider_container_selector => '--border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); // Todo: Remove in version 3.21.0: https://elementor.atlassian.net/browse/ED-11888. // Remove together with support for physical properties inside the container widget. $logical_dimensions_inline_start = is_rtl() ? '{{RIGHT}}{{UNIT}}' : '{{LEFT}}{{UNIT}}'; $logical_dimensions_inline_end = is_rtl() ? '{{LEFT}}{{UNIT}}' : '{{RIGHT}}{{UNIT}}'; $this->add_responsive_control( 'content_padding', [ 'label' => esc_html__( 'Padding', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ $low_specificity_slider_container_selector => '--padding-top: {{TOP}}{{UNIT}}; --padding-right: {{RIGHT}}{{UNIT}}; --padding-bottom: {{BOTTOM}}{{UNIT}}; --padding-left: {{LEFT}}{{UNIT}};', // Todo: Remove in version 3.21.0: https://elementor.atlassian.net/browse/ED-11888. // Remove together with support for physical properties inside the container widget. ':where( [data-core-v316-plus="true"] .elementor-element.elementor-widget-n-carousel .swiper-slide ) > .e-con' => "--padding-block-start: {{TOP}}{{UNIT}}; --padding-inline-end: $logical_dimensions_inline_end; --padding-block-end: {{BOTTOM}}{{UNIT}}; --padding-inline-start: $logical_dimensions_inline_start;", ], 'separator' => 'before', ] ); $this->end_controls_section(); $this->add_carousel_navigation_styling_controls( [ 'css_prefix' => 'e-n-carousel-', 'navigation_styling_custom_settings' => [ 'condition' => [ 'arrows' => 'yes', ], ], ] ); $this->add_carousel_pagination_style_controls( [ 'css_prefix' => 'e-n-carousel-', ] ); } protected function render() { $settings = $this->get_settings_for_display(); $this->num_of_carousel_items = count( $settings['carousel_items'] ?? [] ); $slides = $settings['carousel_items']; $swiper_wrapper_class = Plugin::elementor()->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container'; $direction = $settings['direction']; $has_autoplay_enabled = 'yes' === $settings['autoplay']; $outside_wrapper_classes = [ 'e-n-carousel', $swiper_wrapper_class ]; $this->add_render_attribute( [ 'carousel-outside-wrapper' => [ 'class' => $outside_wrapper_classes, ], 'carousel-inside-wrapper' => [ 'class' => 'swiper-wrapper', 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite', ], ] ); if ( ! empty( $direction ) ) { $this->add_render_attribute( 'carousel-outside-wrapper', 'dir', $direction ); } ?>