File "contact-area.php"

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

<?php
/**
 * Contact Area Widget
 */

namespace Elementor;

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

class Cyarb_Contact_Area extends Widget_Base {

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

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

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

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

	protected function register_controls() {

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

            $repeater = new Repeater();

            $repeater->add_control(
                'icon_type',
                [
                    'label' => __( 'Icon Type', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::SELECT,
                    'label_block' => true,
                    'options' => [
                        '1'  =>__( 'LineIcons Font', 'cyarb-toolkit' ),
                        '2'  => __('Font Awesome', 'cyarb-toolkit' ),
                    ], 
                    'default' => '1',
                ]
            );

            $repeater->add_control(
                'lineicon1',
                [
                    'label' => esc_html__( 'Choose Line Icon', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::TEXT,
                    'condition' => [
                        'icon_type' => '1',
                    ],
                ]
            );

            $repeater->add_control(
                'icon1', [
                    'label' => __( 'Social Icon One', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::ICONS,
                    'default' => [
                        'value' => 'fa fa-phone',
                        'library' => 'solid',
                    ],
                    'condition' => [
                        'icon_type' => '2',
                    ],
                ]
            );

            $repeater->add_control(
                'info_title',
                [
                    'label' => esc_html__( 'Add Information Title', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::TEXT,
                    'default' => esc_html__('Follow Us', 'cyarb-toolkit'),
                ]
            ); 

            $repeater->add_control(
                'info_list', [
                    'label'     => __( 'Information List', 'cyarb-toolkit' ),
                    'type'=>Controls_Manager:: WYSIWYG,
                    'default'   => esc_html__('Altona Rd, Seaholme VIC 3018, Australia', 'cyarb-toolkit'),
                ]
            );

            $this->add_control(
                'list_items',
                [
                    'label' => esc_html__('Card Item', 'cyarb-toolkit'),
                    'type' => Controls_Manager::REPEATER,
                    'fields' => $repeater->get_controls(),
                ]
            );

        $this->end_controls_section();

        $this->start_controls_section(
			'section_style',
			[
				'label' => esc_html__( 'Style', 'cyarb-toolkit' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
        );
        
            $this->add_control(
                'icon_color',
                [
                    'label' => esc_html__( 'Icon Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .single-contact-info-box i' => 'color: {{VALUE}}',
                    ],
                ]
            );

            $this->add_control(
                'contact_title_color',
                [
                    'label' => esc_html__( 'Contact Title Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .single-contact-info-box h3' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'contact_typography',
                    'label' => __( 'Contact Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .single-contact-info-box h3',
                ]
            );
            $this->add_control(
                'content_color',
                [
                    'label' => esc_html__( 'Content Color', 'cyarb-toolkit' ),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .single-contact-info-box p, .single-contact-info-box p a' => 'color: {{VALUE}}',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name' => 'content_typography',
                    'label' => __( 'Content Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .single-contact-info-box p, .single-contact-info-box p a',
                ]
            );
            
        $this->end_controls_section();
    }

	protected function render() {

        $settings = $this->get_settings_for_display();

        ?>
        <div class="contact-info-area pt-100 pb-75">
            <div class="container">
                <div class="row justify-content-center">
                    <?php foreach( $settings['list_items'] as $item ): ?>
                        <div class="col-lg-4 col-md-6 col-sm-6">
                            <div class="single-contact-info-box">
                                <?php if( $item['icon1'] != '' || $item['lineicon1']!='' ): ?>
                                    <?php if( $item['icon_type'] == 1 ){ ?>
                                        <i class="<?php echo esc_attr($item['lineicon1']);?>"></i>
                                    <?php } else {
                                        \Elementor\Icons_Manager::render_icon( $item['icon1'], [ 'aria-hidden' => 'true' ] ); 
                                    } ?>
                                <?php endif; ?>
                                <h3><?php echo esc_html( $item['info_title'] ); ?></h3>
                                <?php echo wp_kses_post( $item['info_list'] ); ?>
                            </div>
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>

        <?php
	}

}

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