File "approach-tab-two.php"

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

<?php
/**
 * Approach Tab Section
 */

namespace Elementor;
class Cyarb_Approach_Tabs2 extends Widget_Base {

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

	public function get_title() {
        return __( 'Approach Tab Two', 'cyarb-toolkit' );
    }

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

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

	protected function register_controls() {

        $this->start_controls_section(
			'feature_tabs',
			[
				'label' => __( 'Approach Tabs', 'cyarb-toolkit' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
        );

            $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',
                ]
            );
            
            $repeater = new Repeater();
			$repeater->add_control(
				'tab_title', [
					'label' => __( 'Tab Title', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::TEXT,
				]
			);
			$repeater->add_control(
				'tab_content', [
					'label' => __( 'Tab Content', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::TEXTAREA,
				]
			);
			$repeater->add_control(
				'image', [
					'label' => __( 'Image', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
            $this->add_control(
                'app_tab_items',
                [
                    'label'   => esc_html__( 'Add Tab Item', 'cyarb-toolkit' ),
                    'type'    => Controls_Manager::REPEATER,
                    'fields'  => $repeater->get_controls(),
                ]
            );

            $this->add_control(
				'shape_image', [
					'label' => __( 'Shape Image', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::MEDIA,
				]
			);
        $this->end_controls_section();

        $this->start_controls_section(
			'tab_style',
			[
				'label' => __( 'Style', 'cyarb-toolkit' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);
            $this->add_control(
                'sec_color',
                [
                    'label'     => __( 'Section Title Color', 'cyarb-toolkit' ),
                    'type'      => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .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'  => 'sect_typography',
                    'label' => __( 'Section Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .section-title h2, .section-title h1, .section-title h3, .section-title h4, .section-title h5, .section-title h6',
                ]
            );
            $this->add_control(
				'tabtitle_color',
				[
					'label' => __( 'Tab Title Color', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .approach-style-list-tabs .nav .nav-item .nav-link h3' => 'color: {{VALUE}}',
					],
				]
			);
			$this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name'  => 'tabtitle_typography',
                    'label' => __( 'Tab Title Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .approach-style-list-tabs .nav .nav-item .nav-link h3',
                ]
            );
            $this->add_control(
				'tabdesc_color',
				[
					'label' => __( 'Tab Description Color', 'cyarb-toolkit' ),
					'type'  => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .approach-style-list-tabs .nav .nav-item .nav-link p' => 'color: {{VALUE}}',
					],
				]
			);
			$this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'name'     => 'tabdesc_typography',
                    'label'    => __( 'Tab Description Typography', 'cyarb-toolkit' ),
                    'selector' => '{{WRAPPER}} .approach-style-list-tabs .nav .nav-item .nav-link p',
                ]
            );
            $this->add_control(
				'acttab_color',
				[
					'label'     => __( 'Active Tab Background Color', 'cyarb-toolkit' ),
					'type'      => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .approach-style-list-tabs .nav .nav-item .nav-link:hover, .approach-style-list-tabs .nav .nav-item .nav-link.active, .body-with-black-color .approach-style-list-tabs .nav .nav-item .nav-link.active' => 'background-color: {{VALUE}}',
					],
				]
			);
        $this->end_controls_section();
    }

	protected function render() {
    $settings = $this->get_settings_for_display();
    ?>
    <div class="approach-style-two-area pt-100 pb-100">
        <div class="container">
            <?php if( $settings['title'] != '' ) : ?>
            <div class="section-title">
                <<?php echo esc_attr($settings['title_tag']);?>><?php echo esc_html( $settings['title'] ); ?></<?php echo esc_attr($settings['title_tag']);?>>
            </div>
            <?php endif; ?>
            
            <div class="approach-style-list-tabs">
                <div class="row align-items-center">
                    <div class="col-lg-7 col-md-12">
                        <div class="tab-content" id="myTabContent">
                            <?php $i = 1;
                            foreach ( $settings['app_tab_items'] as $item ) :
                                if ($i == 1) {
                                    $active = 'show active';
                                } else {
                                    $active = '';
                                }
                            ?>
                            <div class="tab-pane fade <?php echo $active; ?>" id="evolving<?php echo $i; ?>" role="tabpanel">
                                <?php if( $item['image']['url'] != '' ): ?>
                                    <div class="approach-style-tabs-image">
                                        <img src="<?php echo esc_url( $item['image']['url'] ); ?>" alt="<?php echo esc_attr__('image','cyarb-toolkit'); ?>">
                                    </div>
                                <?php endif; ?>
                            </div>
                            <?php $i++; endforeach; ?>
                        </div>
                    </div>

                    <div class="col-lg-5 col-md-12">
                        <ul class="nav nav-tabs" id="myTab" role="tablist">
                            <?php $i = 1;
                            foreach( $settings['app_tab_items'] as $item ): 
                                if ($i == 1) {
                                    $active = 'active';
                                } else {
                                    $active = '';
                                }
                            ?>
                            <li class="nav-item">
                                <a class="nav-link <?php echo $active; ?>" data-bs-toggle="tab" href="#evolving<?php echo $i; ?>" role="tab" aria-controls="evolving-threat">
                                    <h3><?php echo esc_html( $item['tab_title'] ); ?></h3>
                                    <p><?php echo wp_kses_post( $item['tab_content'] ); ?></p>
                                </a>
                            </li>
                            <?php $i++; endforeach; ?>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <?php if( $settings['shape_image']['url'] != '' ) :  ?>
        <div class="approach-style-shape">
            <img src="<?php echo esc_url( $settings['shape_image']['url'] ); ?>" alt="<?php echo esc_attr__('Shape','cyarb-toolkit'); ?>">
        </div>
        <?php endif; ?>

    </div>
<?php }

}

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