%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/public_html/stlc/wp-content/plugins/insur-addon/includes/Widgets/
Upload File :
Create Path :
Current File : /home/opti/public_html/stlc/wp-content/plugins/insur-addon/includes/Widgets/MainSlider.php

<?php

namespace Layerdrops\Insur\Widgets;


class MainSlider extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'insur-main-slider';
    }

    public function get_title()
    {
        return __('Main Slider', 'insur-addon');
    }

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

    public function get_categories()
    {
        return ['insur-category'];
    }

    protected function register_controls()
    {
        $this->start_controls_section(
            'layout_section',
            [
                'label' => __('Layout', 'insur-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'layout_type',
            [
                'label' => __('Select Layout', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::SELECT2,
                'default' => 'layout_one',
                'options' => [
                    'layout_one' => __('Layout One', 'insur-addon'),
                    'layout_two' => __('Layout Two', 'insur-addon'),
                    'layout_three' => __('Layout Three', 'insur-addon'),
                ]
            ]
        );


        $this->end_controls_section();

        $this->start_controls_section(
            'content_section',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'layout_type' => 'layout_one'
                ]
            ]
        );

        $slider = new \Elementor\Repeater();

        $slider->add_control(
            'title',
            [
                'label' => __('Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Title', 'insur-addon'),
            ]
        );

        $slider->add_control(
            'sub_title',
            [
                'label' => __('Sub Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Sub Title', 'insur-addon'),
            ]
        );

        $slider->add_control(
            'button_label',
            [
                'label' => __('Button Text', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Let’s Get Started', 'insur-addon'),
                'label_block' => true,
            ]
        );

        $slider->add_control(
            'button_url',
            [
                'label' => __('Button Url', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::URL,
                'placeholder' => __('#', 'insur-addon'),
                'show_external' => true,
                'default' => [
                    'url' => '#',
                    'is_external' => true,
                    'nofollow' => true,
                ],
                'show_label' => false,
            ]
        );

        $slider->add_control(
            'background_image',
            [
                'label' => __('Background Image', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ],
            ]
        );

        $slider->add_control(
            'background_shape',
            [
                'label' => __('Background Shape', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [],
            ]
        );


        $this->add_control(
            'sliders',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'prevent_empty' => false,
                'condition' => [
                    'layout_type' => 'layout_one'
                ],
                'fields' => $slider->get_controls(),
                'default' => [
                    [
                        'title' => __('Awesome Title', 'insur-addon'),
                    ],
                ],
                'title_field' => '{{{ title }}}',
            ]
        );



        $this->end_controls_section();

        $this->start_controls_section(
            'layout_two_content_section',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'layout_type' => 'layout_two'
                ]
            ]
        );

        $slider_two = new \Elementor\Repeater();

        $slider_two->add_control(
            'title',
            [
                'label' => __('Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Title', 'insur-addon'),
            ]
        );

        $slider_two->add_control(
            'sub_title',
            [
                'label' => __('Sub Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Sub Title', 'insur-addon'),
            ]
        );

        $slider_two->add_control(
            'button_label',
            [
                'label' => __('Button Text', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Let’s Get Started', 'insur-addon'),
                'label_block' => true,
            ]
        );

        $slider_two->add_control(
            'button_url',
            [
                'label' => __('Button Url', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::URL,
                'placeholder' => __('#', 'insur-addon'),
                'show_external' => true,
                'default' => [
                    'url' => '#',
                    'is_external' => true,
                    'nofollow' => true,
                ],
                'show_label' => false,
            ]
        );

        $slider_two->add_control(
            'video_url',
            [
                'label' => __('Video Url', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => '#',
                'label_block' => true
            ]
        );

        $slider_two->add_control(
            'video_caption',
            [
                'label' => __('Video Caption', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => wp_kses(__('Watch <br> How it Works', 'insur-addon'), 'insur_allowed_tags'),
            ]
        );

        $slider_two->add_control(
            'image',
            [
                'label' => __('Image', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ],
            ]
        );

        $this->add_control(
            'slider_two',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => $slider_two->get_controls(),
                'prevent_empty' => false,
                'default' => [
                    [
                        'title' => __('Awesome Title', 'insur-addon'),
                    ],
                ],
                'title_field' => '{{{ title }}}',
            ]
        );

        $this->end_controls_section();

        $this->start_controls_section(
            'layout_three_content_section',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'layout_type' => 'layout_three'
                ]
            ]
        );

        $slider_three = new \Elementor\Repeater();

        $slider_three->add_control(
            'title',
            [
                'label' => __('Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Title', 'insur-addon'),
            ]
        );

        $slider_three->add_control(
            'sub_title',
            [
                'label' => __('Sub Title', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('Awesome Sub Title', 'insur-addon'),
            ]
        );

        $slider_three->add_control(
            'button_label',
            [
                'label' => __('Button Text', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Let’s Get Started', 'insur-addon'),
                'label_block' => true,
            ]
        );

        $slider_three->add_control(
            'button_url',
            [
                'label' => __('Button Url', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::URL,
                'placeholder' => __('#', 'insur-addon'),
                'show_external' => true,
                'default' => [
                    'url' => '#',
                    'is_external' => true,
                    'nofollow' => true,
                ],
                'show_label' => false,
            ]
        );

        $slider_three->add_control(
            'image',
            [
                'label' => __('Image', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ],
            ]
        );

        $this->add_control(
            'slider_three',
            [
                'label' => __('Slider Content', 'insur-addon'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => $slider_three->get_controls(),
                'prevent_empty' => false,
                'default' => [
                    [
                        'title' => __('Awesome Title', 'insur-addon'),
                    ],
                ],
                'title_field' => '{{{ title }}}',
            ]
        );

        $this->end_controls_section();

        //General style
        $this->start_controls_section(
            'general_style',
            [
                'label' => esc_html__('Style Options', 'insur-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        insur_typo_and_color_options($this, 'Title', '{{WRAPPER}} .main-slider h2,{{WRAPPER}} .main-slider-two__title,{{WRAPPER}} .main-slider-three__title', ['layout_one', 'layout_two', 'layout_three']);
        insur_typo_and_color_options($this, 'Sub Title', '{{WRAPPER}} .main-slider__text, {{WRAPPER}} .main-slider-two__text, {{WRAPPER}} .main-slider-three__text', ['layout_one', 'layout_two', 'layout_three']);
        insur_typo_and_color_options($this, 'Button', '{{WRAPPER}} .thm-btn', ['layout_one', 'layout_two', 'layout_three']);
        insur_typo_and_color_options($this, 'Button Background', '{{WRAPPER}} .thm-btn', ['layout_one', 'layout_two', 'layout_three'], 'background-color', false);

        $this->end_controls_section();

        insur_get_elementor_carousel_options($this, ['layout_one', 'layout_two', 'layout_three']);
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        include insur_get_template('main-slider-one.php');
        include insur_get_template('main-slider-two.php');
        include insur_get_template('main-slider-three.php');
    }
}

Zerion Mini Shell 1.0