File "about.php"

Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/plugins/cyarb-toolkit/widgets/about.php
File size: 17.84 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * About Area Widget
 */

namespace Elementor;

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Cyarb_About_Area extends Widget_Base {

	public function get_name() {
        return 'About_Area';
    }

	public function get_title() {
        return esc_html__( 'About Area', 'cyarb-toolkit' );
    }

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

	public function get_categories() {
        return [ 'cyarb-elements' ];
    }

	protected function register_controls() {

        $this->start_controls_section(
			'Cyarb_About_Area',
			[
				'label' => esc_html__( 'Cyarb About Area', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );

            $this->add_control(
                'sec_style',
                [
                    'label' => __( 'Choose Style', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        '1'         => __( 'Style One', 'cyarb-toolkit' ),
                        '2'         => __( 'Style Two', 'cyarb-toolkit' ),
                        '3'         => __( 'Style Three', 'cyarb-toolkit' ),
                    ],
                    'default' => '1',
                ]
            );

            //Shape Images
            $this->add_control(
                'image_shape',
                [
                    'label'    => esc_html__( 'Hide Shapes?', 'cyarb-toolkit' ),
                    'type'     => Controls_Manager::SWITCHER,
                    'label_on' => esc_html__( 'Show', 'cyarb-toolkit' ),
                    'label_off' => esc_html__( 'Hide', 'cyarb-toolkit' ),
                    'return_value' => 'yes',
                    'default' => 'yes',
                    'condition' => [
                        'sec_style!' => '3',
                    ]
                ]
            );
            $this->add_control(
                'shape1',
                [
                    'label' => esc_html__( 'Shape 1', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                    'condition' => [
                        'image_shape' => 'yes',
                        'sec_style!' => '3',
                    ]
                ]
            );
            $this->add_control(
                'shape2',
                [
                    'label' => esc_html__( 'Shape 2', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                    'condition' => [
                        'image_shape' => 'yes',
                        'sec_style'   => '2',
                    ]
                ]
            );
            $this->add_control(
                'shape3',
                [
                    'label' => esc_html__( 'Shape 3', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                    'condition' => [
                        'image_shape' => 'yes',
                        'sec_style'   => '2',
                    ]
                ]
            );

            $this->add_control(
                'title',
                [
                    'label' => esc_html__( 'Title', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::TEXTAREA,
                ]
            );

            $this->add_control(
                'title_tag',
                [
                    'label' => esc_html__( 'Title Tag', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'options' => [
                        'h1'         => esc_html__( 'h1', 'cyarb-toolkit' ),
                        'h2'         => esc_html__( 'h2', 'cyarb-toolkit' ),
                        'h3'         => esc_html__( 'h3', 'cyarb-toolkit' ),
                        'h4'         => esc_html__( 'h4', 'cyarb-toolkit' ),
                        'h5'         => esc_html__( 'h5', 'cyarb-toolkit' ),
                        'h6'         => esc_html__( 'h6', 'cyarb-toolkit' ),
                    ],
                    'default' => 'h2',
                ]
            );

            $this->add_control(
                'content',
                [
                    'label' => esc_html__( 'Content', 'cyarb-toolkit' ),
                    'type'=>Controls_Manager:: WYSIWYG,
                ]
            ); 

        $this->end_controls_section();

        $this->start_controls_section(
			'Cyarb_Lists_Area',
			[
				'label' => esc_html__( 'Cyarb Lists Area', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
        );

            $repeater = new Repeater();
            $repeater->add_control(
                'add_image',
                [
                    'label' => __('Add Icon Image', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::MEDIA,
                    'default' => [
                        'url' => Utils::get_placeholder_image_src(),
                    ]
                ]
            );
            $repeater->add_control(
                'list_title', [
                    'label' => __( 'Add List Title', 'cyarb-toolkit' ),
                    'type'=>Controls_Manager:: TEXT,
                ]
            );
            $repeater->add_control(
                'list_desc',
                [
                    'label'=>__('List Description', 'cyarb-toolkit'),
                    'type'=>Controls_Manager:: WYSIWYG,
                    'description' => __('This text editor for p','cyarb-toolkit'),
                ]
            );
            $this->add_control(
                'slider_content',
                [
                    'label' => __( 'Add Slider Content', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::REPEATER,
                    'fields' => $repeater->get_controls()
                ]
            );
        $this->end_controls_section();

        $this->start_controls_section(
			'section_images',
			[
				'label' => esc_html__( 'Images', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'sec_style!' => '3',
                ]
			]
        );
            $this->add_control(
                'fimage',
                [
                    'label' => esc_html__( 'About Area Image', 'cyarb-toolkit' ),
                    'type'	 => Controls_Manager::MEDIA,
                ]
            );

        $this->end_controls_section();

        $this->start_controls_section(
			'section_style',
			[
				'label' => esc_html__( 'Style', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
        );
        
            $this->add_control(
                'title_color',
                [
                    'label' => esc_html__( 'Title Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .about-content h1, .about-content h2, .about-content h3, .about-content h4, .about-content h5, .about-content h6,  .about-content2 h1, .about-content2 h2, .about-content2 h3, .about-content2 h4, .about-content2 h5, .about-content2 h6, .section-title h2, .section-title h1, .section-title h3, .section-title h4, .section-title h5, .section-title h6' => 'color: {{VALUE}}',
                    ],
                ]
            );

            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'title_typography',
                    'label' => __( 'Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .about-content h1, .about-content h2, .about-content h3, .about-content h4, .about-content h5, .about-content h6,  .about-content2 h1, .about-content2 h2, .about-content2 h3, .about-content2 h4, .about-content2 h5, .about-content2 h6, .section-title h2, .section-title h1, .section-title h3, .section-title h4, .section-title h5, .section-title h6',
                ]
            );

            $this->add_control(
                'content_color',
                [
                    'label' => esc_html__( 'Content Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} p' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'content_typography',
                    'label' => __( 'Content Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} p',
                ]
            );

            $this->add_control(
                'list_head_color',
                [
                    'label' => esc_html__( 'List Head Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .about-content .features-list li h3, .about-content2 .features-list li h3, .single-approach-box h3' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'list_head_typography',
                    'label' => __( 'List Head Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .about-content .features-list li h3, .about-content2 .features-list li h3, .single-approach-box h3',
                ]
            );
            
        $this->end_controls_section();
    }

	protected function render() {

        $settings = $this->get_settings_for_display();

        ?>
        <?php if( $settings['sec_style'] == '1' ): ?>
            <div class="about-area ptb-100">
                <div class="container-fluid">
                    <div class="row align-items-center">
                        <?php if( $settings['fimage']['url'] != '' ) : ?>
                        <div class="col-lg-6 col-md-12">
                            <div class="about-image">
                                <img src="<?php echo esc_url( $settings['fimage']['url'] ); ?>" alt="<?php echo esc_attr__( 'About Us' ); ?>">
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-12">
                        <?php else: ?>
                        <div class="col-lg-12 col-md-12">
                        <?php endif; ?>
                            <div class="about-content">
                                <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                                <?php echo wp_kses_post( $settings['content'] ); ?>
                                <ul class="features-list">
                                    <?php
                                        foreach ( $settings['slider_content'] as $item ) :
                                            if ( $item['list_title'] !='' || $item['list_desc'] !='') : ?>
                                                <li>
                                                    <?php if( $item['add_image']['url'] != '' ) : ?>
                                                        <div class="icon">
                                                            <img src="<?php echo esc_url( $item['add_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Icon' ); ?>">
                                                        </div>
                                                    <?php endif; ?>
                                                    <h3><?php echo esc_html( $item['list_title'] ); ?></h3>
                                                    <?php echo wp_kses_post( $item['list_desc'] ); ?>
                                                </li><?php
                                            endif;
                                        endforeach; 
                                    ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <?php if ( 'yes' === $settings['image_shape'] ) : ?>
                    <?php if( $settings['shape1']['url'] != '' ) : ?>
                        <div class="shape4"><img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape', 'cyarb-toolkit' ); ?>"></div>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        <?php elseif( $settings['sec_style'] == '2' ): ?>
            <div class="about-area2 pb-100">
                <div class="container">
                    <div class="row">
                        <?php if( $settings['fimage']['url'] != '' ) : ?>
                        <div class="col-lg-6 col-md-12">
                            <div class="about-image2 bg-image1" style="background-image: url(<?php echo esc_url( $settings['fimage']['url']); ?> )">
                                <img src="<?php echo esc_url( $settings['fimage']['url'] ); ?>" alt="<?php echo esc_attr__( 'About Us' ); ?>">
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-12">
                        <?php else: ?>
                        <div class="col-lg-12 col-md-12">
                        <?php endif; ?>
                            <div class="about-content2">
                                <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>

                                <?php echo wp_kses_post( $settings['content'] ); ?>

                                <ul class="features-list">
                                    <?php foreach ( $settings['slider_content'] as $item ) :
                                        if ( $item['list_title'] !='' || $item['list_desc'] !='') : ?>
                                            <li>
                                                <?php if( $item['add_image']['url'] != '' ) : ?>
                                                    <img src="<?php echo esc_url( $item['add_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Icon' ); ?>">
                                                <?php endif; ?>
                                                <h3><?php echo esc_html( $item['list_title'] ); ?></h3>
                                                <?php echo wp_kses_post( $item['list_desc'] ); ?>
                                            </li><?php
                                        endif;
                                    endforeach; ?>
                                </ul>
                            </div>
                        </div>

                    </div>
                </div>

                <?php if ( 'yes' === $settings['image_shape'] ) : ?>
                    <?php if( $settings['shape1']['url'] != '' ) : ?>
                        <div class="shape2"><img src="<?php echo esc_url( $settings['shape1']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape', 'cyarb-toolkit' ); ?>"></div>
                    <?php endif; ?>
                    <?php if( $settings['shape2']['url'] != '' ) : ?>
                        <div class="shape3"><img src="<?php echo esc_url( $settings['shape2']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape', 'cyarb-toolkit' ); ?>"></div>
                    <?php endif; ?>
                    <?php if( $settings['shape3']['url'] != '' ) : ?>
                        <div class="shape4"><img src="<?php echo esc_url( $settings['shape3']['url'] ); ?>" alt="<?php echo esc_attr__( 'Shape', 'cyarb-toolkit' ); ?>"></div>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        <?php else : ?>
            <div class="approach-area pt-100 pb-75">
                <div class="container">
                    <?php if( $settings['title'] != '' || $settings['content'] != '' ) : ?>
                        <div class="section-title">
                            <<?php echo esc_attr( $settings['title_tag'] ); ?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr( $settings['title_tag'] ); ?>>
                            <?php echo wp_kses_post( $settings['content'] ); ?>
                        </div>
                    <?php endif; ?>

                    <div class="row justify-content-center">
                        <?php foreach ( $settings['slider_content'] as $item ) :
                            if ( $item['list_title'] !='' || $item['list_desc'] !='') : ?>
                            <div class="col-lg-4 col-md-6">
                                <div class="single-approach-box">
                                    <?php if( $item['add_image']['url'] != '' ) : ?>
                                        <div class="icon">
                                            <img src="<?php echo esc_url( $item['add_image']['url'] ); ?>" alt="<?php echo esc_attr__( 'Icon' ); ?>">
                                        </div>
                                    <?php endif; ?>
                                    <h3><?php echo esc_html( $item['list_title'] ); ?></h3>
                                    <?php echo wp_kses_post( $item['list_desc'] ); ?>
                                </div>
                            </div>
                            <?php endif;
                        endforeach; ?>
                    </div>
                </div>
            </div>
        <?php endif; ?>
        <?php
	}

}

Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_About_Area );