start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'nighty' ), ] ); // Add Class control $this->add_control( 'list_image', [ 'label' => esc_html__( 'Add Images', 'nighty' ), 'type' => \Elementor\Controls_Manager::GALLERY, 'default' => [], ] ); $this->end_controls_section(); /***************************************************************** START SECTION ADDITIONAL ******************************************************************/ $this->start_controls_section( 'section_additional_options', [ 'label' => esc_html__( 'Additional Options', 'nighty' ), ] ); /*************************** VERSION ***********************/ $this->add_control( 'margin_items', [ 'label' => esc_html__( 'Margin Right Items', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'default' => 30, ] ); $this->add_control( 'item_number', [ 'label' => esc_html__( 'Item Number', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'description' => esc_html__( 'Number Item', 'nighty' ), 'default' => 6, ] ); $this->add_control( 'slides_to_scroll', [ 'label' => esc_html__( 'Slides to Scroll', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'description' => esc_html__( 'Set how many slides are scrolled per swipe.', 'nighty' ), 'default' => 1, ] ); $this->add_control( 'pause_on_hover', [ 'label' => esc_html__( 'Pause on Hover', 'nighty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'nighty' ), 'no' => esc_html__( 'No', 'nighty' ), ], 'frontend_available' => true, ] ); $this->add_control( 'infinite', [ 'label' => esc_html__( 'Infinite Loop', 'nighty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'nighty' ), 'no' => esc_html__( 'No', 'nighty' ), ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay', [ 'label' => esc_html__( 'Autoplay', 'nighty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'options' => [ 'yes' => esc_html__( 'Yes', 'nighty' ), 'no' => esc_html__( 'No', 'nighty' ), ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay_speed', [ 'label' => esc_html__( 'Autoplay Speed', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'default' => 3000, 'step' => 500, 'condition' => [ 'autoplay' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'smartspeed', [ 'label' => esc_html__( 'Smart Speed', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'default' => 500, ] ); $this->add_control( 'dot_control', [ 'label' => esc_html__( 'Show Dots', 'nighty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'nighty' ), 'no' => esc_html__( 'No', 'nighty' ), ], 'frontend_available' => true, ] ); $this->add_control( 'nav_control', [ 'label' => esc_html__( 'Show Nav', 'nighty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'nighty' ), 'no' => esc_html__( 'No', 'nighty' ), ], 'frontend_available' => true, ] ); $this->end_controls_section(); /**************************** END SECTION ADDITIONAL *********************/ /************* STYLE SECTION GENERAL *******************/ $this->start_controls_section( 'section_style_image', [ 'label' => esc_html__( 'Image', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_height', [ 'label' => esc_html__( 'Max Height', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 30, 'max' => 300, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel img' => 'max-height:{{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); ############### end section GENERAL ############### /************* SECTION DOTs. *******************/ $this->start_controls_section( 'section_dot', [ 'label' => esc_html__( 'Dots', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'dot_control' => 'yes', ] ] ); $this->add_control( 'dot_color', [ 'label' => esc_html__( 'Dot Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-dots button' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'dot_active_color', [ 'label' => esc_html__( 'Dot Active Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-dots button.active' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'dot_width', [ 'label' => esc_html__( 'Size', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 300, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-dots button' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'dots_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-dots button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); ############### end section dot ############### /************* SECTION NAV. *******************/ $this->start_controls_section( 'section_nav', [ 'label' => esc_html__( 'Nav', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'nav_control' => 'yes', ] ] ); $this->add_responsive_control( 'nav_top', [ 'label' => esc_html__( 'Top', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav' => 'bottom: calc(100% + {{SIZE}}{{UNIT}})', ], ] ); $this->add_control( 'nav_width', [ 'label' => esc_html__( 'Size', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 300, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'icon_size_nav', [ 'label' => esc_html__( 'Icon Size', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 300, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'nav__bg_color_', [ 'label' => esc_html__( 'Background', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'nav__bg_color_hover', [ 'label' => esc_html__( 'Background Hover', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button:hover' => 'background-color : {{VALUE}};', ], ] ); $this->add_control( 'bg_icon_color', [ 'label' => esc_html__( 'Icon', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button i' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'nav__bg_icon_color_hover', [ 'label' => esc_html__( 'Icon Hover', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-images-slider.owl-carousel .owl-nav button:hover i' => 'color : {{VALUE}};', ], ] ); $this->end_controls_section(); ############### end section nav ############### } // Render Template Here protected function render() { $settings = $this->get_settings(); $list_image = $settings['list_image']; $data_options['items'] = $settings['item_number'] ? $settings['item_number'] : 6; $data_options['slideBy'] = $settings['slides_to_scroll']; $data_options['margin'] = $settings['margin_items'] ? $settings['margin_items'] : 0; $data_options['autoplayHoverPause'] = $settings['pause_on_hover'] === 'yes' ? true : false; $data_options['loop'] = $settings['infinite'] === 'yes' ? true : false; $data_options['autoplay'] = $settings['autoplay'] === 'yes' ? true : false; $data_options['autoplayTimeout'] = $settings['autoplay_speed'] ? $settings['autoplay_speed'] : '3000'; $data_options['smartSpeed'] = $settings['smartspeed'] ? $settings['smartspeed'] : '500'; $data_options['dots'] = $settings['dot_control'] === 'yes' ? true : false; $data_options['nav'] = $settings['nav_control'] === 'yes' ? true : false; $data_options['rtl'] = is_rtl() ? true: false; ?> register( new Nighty_Elementor_Slide_Image() );