Your IP : 216.73.216.0


Current Path : /home/goldnueh/netsetsolution.com/wp-content/plugins/zeinet-addon/includes/Widgets/
Upload File :
Current File : /home/goldnueh/netsetsolution.com/wp-content/plugins/zeinet-addon/includes/Widgets/CustomBlog.php

<?php

namespace Layerdrops\Zeinet\Widgets;


class CustomBlog extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'zeinet-custom-blog';
    }

    public function get_title()
    {
        return __('Custom Blog Widget', 'zeinet-addon');
    }

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

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

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

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

        $this->end_controls_section();

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

        $this->add_control(
            'sec_title',
            [
                'label' => __('Section Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Title', 'zeinet-addon'),
                'default' => __('Default Title', 'zeinet-addon'),
            ]
        );

        $this->add_control(
            'sec_sub_title',
            [
                'label' => __('Section Sub Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Sub Title', 'zeinet-addon'),
                'default' => __('Default Sub Title', 'zeinet-addon'),
            ]
        );

        $layout_one_blog_post = new \Elementor\Repeater();

        $layout_one_blog_post->add_control(
            'select_post',
            [
                'label'       => esc_html__('Select Post', 'zeinet-addon'),
                'label_block' => true,
                'type'        => \Elementor\Controls_Manager::SELECT,
                'options'     => zeinet_post_query('post'),
            ]
        );

        $layout_one_blog_post->add_control(
            'custom_title',
            [
                'label' => __('Custom Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Custom Title', 'zeinet-addon'),
                'default' => '',
            ]
        );

        $layout_one_blog_post->add_control(
            'summary_text',
            [
                'label' => __('Summary Text', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Summary Text', 'zeinet-addon'),
                'default' => __('Default Text', 'zeinet-addon'),
            ]
        );

        $layout_one_blog_post->add_control(
            'read_more_text',
            [
                'label' => __('Read More Text', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'placeholder' => __('Add Read More Text', 'zeinet-addon'),
                'default' => __('Read More', 'zeinet-addon'),
                'label_block' => true
            ]
        );

        $layout_one_blog_post->add_control(
            'image',
            [
                'label' => __('Image', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [],
            ]
        );

        $this->add_control(
            'layout_one_blog_post',
            [
                'label' => __('Blog Post', 'zeinet-addon'),
                'prevent_empty' => false,
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => $layout_one_blog_post->get_controls(),
                'title_field' => '{{{ name }}}',
            ]
        );

        $this->end_controls_section();

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

        $this->add_control(
            'layout_two_sec_title',
            [
                'label' => __('Section Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Title', 'zeinet-addon'),
                'default' => __('Default Title', 'zeinet-addon'),
            ]
        );

        $this->add_control(
            'layout_two_sec_sub_title',
            [
                'label' => __('Section Sub Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Sub Title', 'zeinet-addon'),
                'default' => __('Default Sub Title', 'zeinet-addon'),
            ]
        );

        $layout_two_blog_post = new \Elementor\Repeater();

        $layout_two_blog_post->add_control(
            'select_post',
            [
                'label'       => esc_html__('Select Post', 'zeinet-addon'),
                'label_block' => true,
                'type'        => \Elementor\Controls_Manager::SELECT,
                'options'     => zeinet_post_query('post'),
            ]
        );

        $layout_two_blog_post->add_control(
            'custom_title',
            [
                'label' => __('Custom Title', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Custom Title', 'zeinet-addon'),
                'default' => '',
            ]
        );


        $layout_two_blog_post->add_control(
            'summary_text',
            [
                'label' => __('Summary Text', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder' => __('Add Summary Text', 'zeinet-addon'),
                'default' => __('default text', 'zeinet-addon'),
            ]
        );


        $layout_two_blog_post->add_control(
            'read_more_text',
            [
                'label' => __('Read More Text', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'placeholder' => __('Add Read More Text', 'zeinet-addon'),
                'default' => __('Read More', 'zeinet-addon'),
                'label_block' => true
            ]
        );


        $layout_two_blog_post->add_control(
            'image',
            [
                'label' => __('Image', 'zeinet-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [],
            ]
        );

        $this->add_control(
            'layout_two_blog_post',
            [
                'label' => __('Blog Post', 'zeinet-addon'),
                'prevent_empty' => false,
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => $layout_two_blog_post->get_controls(),
            ]
        );


        $this->end_controls_section();

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

        zeinet_typo_and_color_options($this, 'Section Title', '{{WRAPPER}} .section-title__title', ['layout_one', 'layout_two']);
        zeinet_typo_and_color_options($this, 'Section Sub Title', '{{WRAPPER}} .section-title__tagline', ['layout_one', 'layout_two']);
        zeinet_typo_and_color_options($this, 'Title', '{{WRAPPER}} .news-three__single__title a,{{WRAPPER}} .news-three__list__title a,{{WRAPPER}} .news-four__single__title a', ['layout_one', 'layout_two']);
        zeinet_typo_and_color_options($this, 'Summary', '{{WRAPPER}} .news-three__single__text,{{WRAPPER}} .news-four__single__text', ['layout_one', 'layout_two']);
        zeinet_typo_and_color_options($this, 'Meta', '{{WRAPPER}} .news-three__single__meta li,{{WRAPPER}} .news-three__list__meta,{{WRAPPER}} .news-four__single__meta,{{WRAPPER}} .news-four__single__meta li', ['layout_one', 'layout_two']);

        zeinet_typo_and_color_options($this, 'Button', '{{WRAPPER}} .thm-btn', ['layout_one', 'layout_two']);
        zeinet_typo_and_color_options($this, 'Button Background', '{{WRAPPER}} .thm-btn', ['layout_one', 'layout_two'], 'background-color', false);

        $this->end_controls_section();
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        include zeinet_get_template('custom-blog-one.php');
        include zeinet_get_template('custom-blog-two.php');
    }
}