<?php
// End recent blog with thumlist for post single page



function enqueue_owl_carousel_homepage($atts) {
    wp_enqueue_script('glorious-slider-script', get_stylesheet_directory_uri() . '/elementor/owl-carousel/js/owl.carousel.min.js', array(
        'jquery'
    ));
    wp_enqueue_style('glorious-slider-style', get_stylesheet_directory_uri() . '/elementor/owl-carousel/css/owl.carousel.min.css');
    wp_enqueue_style('owl-slider-home', get_stylesheet_directory_uri() . '/elementor/owl-carousel/css/owl-testimonials.css');

}
add_action('wp_footer', 'enqueue_owl_carousel_homepage');

// Register the widget
add_action('elementor/widgets/widgets_registered', function () {
    class Custom_Widget extends \Elementor\Widget_Base {

        public function get_name() {
            return 'owl-slider-testimonials';
        }

        public function get_title() {
            return __('Custom Testimonials 01', 'text-domain');
        }

        public function get_icon() {
            return 'eicon-button';
        }

        public function get_categories() {
            return ['basic'];
        }

        protected function _register_controls() {
            // Repeater control for dynamic content
            $this->start_controls_section(
                'content_section',
                [
                    'label' => __('Content', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                ]
            );

            $this->add_control(
                'switch_label',
                [
                    'label' => __('Switch Label', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => __('Show', 'text-domain'),
                    'label_off' => __('Hide', 'text-domain'),
                    'default' => 'yes', // Set the default value
                    'prefix_class' => 'elementor-switch-label-', // Add a class prefix for styling
                ]
            );


            $repeater = new \Elementor\Repeater();

            // Title field
            $repeater->add_control(
                'title',
                [
                    'label' => __('Title', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::TEXT,
                    'default' => __('Title', 'text-domain'),
                    'label_block' => true,
                ]
            );

            $repeater->add_control(
                'possession',
                [
                    'label' => __('possession', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::TEXT,
                    'default' => __('possession', 'text-domain'),
                    'label_block' => true,
                ]
            );

           

            



            // Content field
            $repeater->add_control(
                'content',
                [
                    'label' => __('Content', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::WYSIWYG,
                    'default' => __('Content', 'text-domain'),
                    'show_label' => false,
                ]
            );

            // Image field
            $repeater->add_control(
                'image',
                [
                    'label' => __('Image', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::MEDIA,
                ]
            );
             // Image field
             $repeater->add_control(
                'image-2',
                [
                    'label' => __('Copmany Logo', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::MEDIA,
                ]
            );



            $this->add_control(
                'items',
                [
                    'type' => \Elementor\Controls_Manager::REPEATER,
                    'fields' => $repeater->get_controls(),
                    'default' => [
                        [
                            'title' => __('Default Title', 'text-domain'),
                            'content' => __('Default Content', 'text-domain'),
                            'image' => '',
                            'button_text' => __('Read More', 'text-domain'),
                            'button_url' => ['url' => 'https://example.com'],
                        ],
                    ],
                    'title_field' => '{{{ title }}}',
                ]
            );

            $this->end_controls_section();

            $this->start_controls_section(
                'quote_icon',
                [
                    'label' => __('Quote Icon', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                ]
            );
            
            $this->add_responsive_control(
                'icon_visibility',
                [
                    'label' => esc_html__('Icon Visibility', 'textdomain'),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => __('Show', 'textdomain'),
                    'label_off' => __('Hide', 'textdomain'),
                    'return_value' => 'yes',
                    'default' => 'yes',
                ]
            );
            
            $this->add_responsive_control(
                'icon',
                [
                    'label' => esc_html__( 'Icon', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::ICONS,
                    'default' => [
                        'value' => 'fas fa-circle',
                        'library' => 'fa-solid',
                    ],
                    'recommended' => [
                        'fa-solid' => [
                            'circle',
                            'dot-circle',
                            'square-full',
                        ],
                        'fa-regular' => [
                            'circle',
                            'dot-circle',
                            'square-full',
                        ],
                    ],
                    'condition' => [
                        'icon_visibility' => 'yes', // Show icon only if visibility switcher is set to 'yes'
                    ],
                ]
            );

            $this->add_responsive_control(
                'icon_position',
                [
                    'label' => esc_html__('Icon Position', 'textdomain'),
                    'type' => \Elementor\Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __('Left', 'textdomain'),
                            'icon' => 'eicon-h-align-left',
                        ],
                        'center' => [
                            'title' => __('Center', 'textdomain'),
                            'icon' => 'eicon-h-align-center',
                        ],
                        'right' => [
                            'title' => __('Right', 'textdomain'),
                            'icon' => 'eicon-h-align-right',
                        ],
                    ],
                    'default' => 'center',

                    'condition' => [
                        'icon_visibility' => 'yes', // Show icon only if visibility switcher is set to 'yes'
                    ],

                ]
            );

            $this->add_responsive_control(
                'icon_size',
                [
                    'label' => esc_html__( 'Icon Size', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::SLIDER,
                    'size_units' => [ 'px', 'em', 'rem' ],
                    'range' => [
                        'px' => [
                            'min' => 10,
                            'max' => 100,
                        ],
                        'em' => [
                            'min' => 1,
                            'max' => 10,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .my-icon-wrapper i' => 'font-size: {{SIZE}}{{UNIT}};',
                    ],
                    'condition' => [
                        'icon_visibility' => 'yes',
                    ],
                ]
            );
            
            $this->add_responsive_control(
                'icon_color',
                [
                    'label' => esc_html__( 'Icon Color', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .my-icon-wrapper svg' => 'fill: {{VALUE}};',
                        '{{WRAPPER}} .my-icon-wrapper i' => 'color: {{VALUE}};',
                    ],
                    'condition' => [
                        'icon_visibility' => 'yes',
                    ],
                ]
            );

            

            
            $this->end_controls_section();
            
            $this->start_controls_section(
                'slider_setting',
                [
                    'label' => __('Slider Setting', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                ]
            );

            $this->add_responsive_control(
                'margin',
                [
                    'label' => __('Margin', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::NUMBER,
                    'default' => __('0', 'text-domain'),
                    'show_label' => true,
                ]
            );
            $this->add_responsive_control(
                'nav',
                [
                    'label' => esc_html__( 'Nav', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => esc_html__( 'Yes', 'textdomain' ),
                    'label_off' => esc_html__( 'No', 'textdomain' ),
                    'return_value' => 'yes',
                    'default' => 'yes',
                ]
            );
            $this->add_responsive_control(
                'dots',
                [
                    'label' => esc_html__( 'Dots', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => esc_html__( 'Yes', 'textdomain' ),
                    'label_off' => esc_html__( 'No', 'textdomain' ),
                    'return_value' => 'yes',
                    'default' => 'yes',
                ]
            );
    
            $this->add_responsive_control(
                'loop',
                [
                    'label' => esc_html__( 'Loop', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => esc_html__( 'Yes', 'textdomain' ),
                    'label_off' => esc_html__( 'No', 'textdomain' ),
                    'return_value' => 'yes',
                    'default' => 'yes',
                ]
            );

            $this->add_responsive_control(
                'autoplay',
                [
                    'label' => esc_html__( 'Autoplay', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::SWITCHER,
                    'label_on' => esc_html__( 'Yes', 'textdomain' ),
                    'label_off' => esc_html__( 'No', 'textdomain' ),
                    'return_value' => 'yes',
                    'default' => 'yes',
                ]
            );
            $this->add_responsive_control(
                'autoplayTimeout',
                [
                    'label' => esc_html__( 'AutoplayTimeout', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::NUMBER,
                    'default' => __('1000', 'text-domain'),
                    'show_label' => true,
                ]
            );

            $this->add_responsive_control(
                'rdesktop',
                [
                    'label' => esc_html__( 'Desktop', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::NUMBER,
                    'default' => __('1', 'text-domain'),
                    'show_label' => true,
                ]
            );
            $this->add_responsive_control(
                'rtablet',
                [
                    'label' => esc_html__( ' Tablet', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::NUMBER,
                    'default' => __('1', 'text-domain'),
                    'show_label' => true,
                ]
            );

            $this->add_responsive_control(
                'rmobile',
                [
                    'label' => esc_html__( 'Mobile', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::NUMBER,
                    'default' => __('1', 'text-domain'),
                    'show_label' => true,
                ]
            );
    
           
            $this->end_controls_section();

            $this->start_controls_section(
                'style_section',
                [
                    'label' => __('Style', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                ]
            );
        
            $this->add_responsive_control(
                'inner_padding',
                [
                    'label' => __( 'Padding', 'text-domain' ),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px', '%', 'em' ],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
            $this->add_responsive_control(
                'inner_margin',
                [
                    'label' => __( 'Margin', 'text-domain' ),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px', '%', 'em' ],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
            $this->add_responsive_control(
                'inner_background_color',
                [
                    'label' => __('Background Color', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'background-color: {{VALUE}};',
                    ],
                ]
            );
        
            $this->add_responsive_control(
                'inner_border_color_outer',
                [
                    'label' => __('Border Color', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'border-color: {{VALUE}};',
                    ],
                ]
            );
        
            $this->add_responsive_control(
                'inner_border_width',
                [
                    'label' => __('Border Width', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', 'em', '%'],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );

            $this->add_responsive_control(
                'inner_border_style',
                [
                    'label' => __( 'Border Style', 'text-domain' ),
                    'type' => \Elementor\Controls_Manager::SELECT,
                    'options' => [
                        'solid' => __( 'Solid', 'text-domain' ),
                        'dashed' => __( 'Dashed', 'text-domain' ),
                        'dotted' => __( 'Dotted', 'text-domain' ),
                        'double' => __( 'Double', 'text-domain' ),
                        'groove' => __( 'Groove', 'text-domain' ),
                        'ridge' => __( 'Ridge', 'text-domain' ),
                        'inset' => __( 'Inset', 'text-domain' ),
                        'outset' => __( 'Outset', 'text-domain' ),
                        'none' => __( 'None', 'text-domain' ),
                        'hidden' => __( 'Hidden', 'text-domain' ),
                    ],
                    'default' => 'solid',
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'border-style: {{VALUE}};',
                    ],
                ]
            );
            $this->add_responsive_control(
                'inner_border_radius',
                [
                    'label' => __( 'Border Radius', 'text-domain' ),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px', '%', 'em' ],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
            

            $this->add_responsive_control(
                'inner_box_shadow',
                [
                    'label' => esc_html__( 'Box Shadow', 'textdomain' ),
                    'type' => \Elementor\Controls_Manager::BOX_SHADOW,
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_inner' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}};',
                    ],
                ]
            );
            
		
          
            
        
            $this->end_controls_section();

            

            $this->start_controls_section(
                'title_style_section',
                [
                    'label' => __('Title', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                ]
            );
        
           
            $this->add_responsive_control(
                'title_padding',
                [
                    'label' => __('Padding', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .testi_name' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
           
          
            $this->add_responsive_control(
                'title_alignment',
                [
                    'label' => __('Text Alignment', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __('Left', 'text-domain'),
                            'icon' => 'eicon-text-align-left',
                        ],
                        'center' => [
                            'title' => __('Center', 'text-domain'),
                            'icon' => 'eicon-text-align-center',
                        ],
                        'right' => [
                            'title' => __('Right', 'text-domain'),
                            'icon' => 'eicon-text-align-right',
                        ],
                        'justify' => [
                            'title' => __('Justify', 'text-domain'),
                            'icon' => 'eicon-text-align-justify',
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .testi_name' => 'text-align: {{VALUE}};',
                    ],
                    'default' => 'left',
                ]
            );


            // Title color control
            $this->add_responsive_control(
                'title_color',
                [
                    'label' => __('Color', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .testi_name' => 'color: {{VALUE}};',
                    ],
                ]
            );
        
            $this->add_group_control(
                \Elementor\Group_Control_Typography::get_type(),
                [
                    'name' => 'sliderTitle_typography',
                    'selector' => '{{WRAPPER}} .testi_name',
                ]
            );



            $this->end_controls_section();

            $this->start_controls_section(
                'position_style_section',
                [
                    'label' => __('Possession', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                ]
            );
        
            // Title padding control
            $this->add_responsive_control(
                'position_title_padding',
                [
                    'label' => __('Padding', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .possession' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
           
            // Title text alignment control
            $this->add_responsive_control(
                'position_title_alignment',
                [
                    'label' => __('Text Alignment', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __('Left', 'text-domain'),
                            'icon' => 'eicon-text-align-left',
                        ],
                        'center' => [
                            'title' => __('Center', 'text-domain'),
                            'icon' => 'eicon-text-align-center',
                        ],
                        'right' => [
                            'title' => __('Right', 'text-domain'),
                            'icon' => 'eicon-text-align-right',
                        ],
                        'justify' => [
                            'title' => __('Justify', 'text-domain'),
                            'icon' => 'eicon-text-align-justify',
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .possession' => 'text-align: {{VALUE}};',
                    ],
                    'default' => 'left',
                ]
            );


            // Title color control
            $this->add_responsive_control(
                'position_title_color',
                [
                    'label' => __('Color', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .possession' => 'color: {{VALUE}};',
                    ],
                ]
            );
        
            $this->add_group_control(
                \Elementor\Group_Control_Typography::get_type(),
                [
                    'name' => 'position_title_typography',
                    'selector' => '{{WRAPPER}} .possession',
                ]
            );



            $this->end_controls_section();




            $this->start_controls_section(
                'img_style_section',
                [
                    'label' => __('Image', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                ]
            );

             //  padding control
             $this->add_responsive_control(
                'img_padding',
                [
                    'label' => __('Padding', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .owl-img img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );

              //  padding control
              $this->add_responsive_control(
                'img_margin',
                [
                    'label' => __('Margin', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .owl-img img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );


            $this->add_responsive_control(
                'img_border_radius',
                [
                    'label' => __( 'Border Radius', 'text-domain' ),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px', '%', 'em' ],
                    'selectors' => [
                        '{{WRAPPER}} .owl-img img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );

            $this->add_responsive_control(
                'img_alignment',
                [
                    'label' => __('Alignment', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __('Left', 'text-domain'),
                            'icon' => 'eicon-text-align-left',
                        ],
                        'center' => [
                            'title' => __('Center', 'text-domain'),
                            'icon' => 'eicon-text-align-center',
                        ],
                        'right' => [
                            'title' => __('Right', 'text-domain'),
                            'icon' => 'eicon-text-align-right',
                        ],
                        'justify' => [
                            'title' => __('Justify', 'text-domain'),
                            'icon' => 'eicon-text-align-justify',
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .owl-img' => 'text-align: {{VALUE}};',
                    ],
                    'default' => 'left',
                ]
            );





            $this->end_controls_section();

            $this->start_controls_section(
                'content_style_section',
                [
                    'label' => __('Content', 'text-domain'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                ]
            );

             //  padding control
             $this->add_responsive_control(
                'content_padding',
                [
                    'label' => __('Padding', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );

              //  padding control
              $this->add_responsive_control(
                'content_margin',
                [
                    'label' => __('Margin', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::DIMENSIONS,
                    'size_units' => ['px', '%', 'em'],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );

            $this->add_responsive_control(
                'content_color',
                [
                    'label' => __('Color', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_content' => 'color: {{VALUE}};',
                    ],
                ]
            );
        
            $this->add_responsive_control(
                'content_alignment',
                [
                    'label' => __('Text Alignment', 'text-domain'),
                    'type' => \Elementor\Controls_Manager::CHOOSE,
                    'options' => [
                        'left' => [
                            'title' => __('Left', 'text-domain'),
                            'icon' => 'eicon-text-align-left',
                        ],
                        'center' => [
                            'title' => __('Center', 'text-domain'),
                            'icon' => 'eicon-text-align-center',
                        ],
                        'right' => [
                            'title' => __('Right', 'text-domain'),
                            'icon' => 'eicon-text-align-right',
                        ],
                        'justify' => [
                            'title' => __('Justify', 'text-domain'),
                            'icon' => 'eicon-text-align-justify',
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .testimonials_content p' => 'text-align: {{VALUE}};',
                    ],
                    'default' => 'left',
                ]
            );






            $this->end_controls_section();


            
        }

        protected function render() {
            $settings = $this->get_settings_for_display();
            $margin = $settings['margin'];
            $settings["nav"] = ($settings["nav"] == "yes") ? "true" : "false";
            $settings["dots"] = ($settings["dots"] == "yes") ? "true" : "false";
            $settings["autoplay"] = ($settings["autoplay"] == "yes") ? "true" : "false";
            $settings["loop"] = ($settings["loop"] == "yes") ? "true" : "false";
            $autoplayTimeout = $settings['autoplayTimeout'];
            $rdesktop = $settings['rdesktop'];
            $rtablet = $settings['rtablet'];
            $rmobile = $settings['rmobile'];
            $quote_icon = $settings['icon_visibility'];
            
        global $slider_id;


          echo '<div class="owl-carousel gl_slider_testimonials_01" id="_gl_slider_testimonials_01">';
            foreach ($settings['items'] as $item) {
                ?>
              <div class="item">
            <div class="item-box">
                <div class="testimonials_inner">

                    <?php if ($quote_icon === 'yes' && $settings['icon']['value']) : ?>
                        <div class="my-icon-wrapper" style="text-align: <?php echo esc_attr($settings['icon_position']); ?>">
                            <?php if ($settings['icon']['library'] === 'svg') : ?>
                                <?php echo wp_kses_post($settings['icon']['value']); ?>
                            <?php else : ?>
                                <i class="<?php echo esc_attr($settings['icon']['value']); ?>"></i>
                            <?php endif; ?>
                        </div>
                <?php endif; ?>
                    <?php if (!empty($item['image']['url'])) : ?>
                        <div class="owl-img">
                            <img src="<?php echo esc_url($item['image']['url']); ?>" alt="<?php echo esc_attr($item['title']); ?>">
                        </div>
                    <?php endif; ?>
                    <div class="testimonials_content">
                    <div class="quote-icn">
                        <i class="fas fa-solid fa-quote-left"></i>
                    </div>
                    <div class="testi_name"> <?php echo $item['title']; ?> </div>
                        
                    <?php echo $item['content']; ?> 

                    <?php if($item['possession'])
                    {
                       echo '<div class="possession"> '.$item['possession'].' </div>';
                    }
                    ?> 

                    </div>
                </div>
            </div>
        </div>
                <?php
            }
            echo "</div>";
            ?>
            <script>
jQuery(document).ready(function($) {
            var owl = jQuery('#_gl_slider_testimonials_01');
            owl.owlCarousel({
                stagePadding: 0,
                margin: <?php echo  $settings["margin"]; ?>,
                nav:<?php echo  $settings["nav"]; ?>,
                dots: <?php echo  $settings["dots"]; ?>,
                loop: <?php echo  $settings["loop"]; ?>,
                autoplay:<?php echo  $settings["autoplay"]; ?>,
                autoplayTimeout:1000,
                responsive: {
                    0: { items: <?php echo $rmobile  ?>},
                    600: {items:<?php echo $rtablet  ?>},
                    1000: {items: <?php echo $rdesktop  ?>}
                }
            });

            var prevBtn10 = jQuery('.prev-btn');
        var nextBtn10 = jQuery('.next-btn');
        var mySlider10 = jQuery('#_gl_slider_homepage'); // Replace 'mySlider10' with your actual slider ID
        // Manually control the slider navigation
        prevBtn10.click(function() {
          mySlider10.trigger('prev.owl.carousel');
        });
        
        nextBtn10.click(function() {
          mySlider10.trigger('next.owl.carousel');
        });
        
        // Update button states based on current slide index
        mySlider10.on('changed.owl.carousel', function(event) {
          var currentSlide = event.relatedTarget.current();
          var totalSlides = event.relatedTarget.maximum();
          prevBtn10.prop('disabled', currentSlide === 0);
          nextBtn10.prop('disabled', currentSlide === totalSlides - 0);
         
        });

    });
</script>


            <?php 
        //     echo  '<div class="custom-nav">
        //     <button class="prev-btn2"></button>
        //     <button class="next-btn2"></button>
        //   </div>';
        }
    }

    \Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Custom_Widget());
    
});




?> 