<?php



use Elementor\Widget_Base;
use Elementor\Controls_Manager;

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


class Headingwtbuttonkaveh extends Widget_Base{

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

  public function get_title(){
    return esc_html__( 'Heading with Button Element', 'kavehTheme' );
  }

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

  public function get_categories(){
    return ['kavehelements'];
  }

  protected function register_controls(){
    
    $this->start_controls_section(
        'contentheadingwtbuttonkaveh',
        [
          'label' => esc_html__( 'Element Content', 'kavehTheme' ),
                  'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        ]
      );
        $this->add_control(
          'beforetitleheadingwtbuttonkaveh',
          [
              'label' => esc_html__( 'Subtitle', 'kavehTheme' ),
			'type' => \Elementor\Controls_Manager::TEXT,
			'default' => esc_html__( 'Subtitle', 'kavehTheme' ),
      
          ]
      );
      $this->add_control(
        'tagheading1headingwtbuttonkaveh',
        [
          'label' => esc_html__( 'Subtitle Tag', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::SELECT,
          'default' => 'H6',
          'options' => [
            'H1'  => esc_html__( 'H1', 'kavehTheme' ),
            'H2' => esc_html__( 'H2', 'kavehTheme' ),
            'H3' => esc_html__( 'H3', 'kavehTheme' ),
            'H4' => esc_html__( 'H4', 'kavehTheme' ),
            'H5' => esc_html__( 'H5', 'kavehTheme' ),
            'H6' => esc_html__( 'H6', 'kavehTheme' ),
            'p' => esc_html__( 'p', 'kavehTheme' ),
            'div' => esc_html__( 'div', 'kavehTheme' ),
          ],
        ]
      );
      $this->add_control(
        'titlebheadingwtbuttonkaveh',
        [
            'label' => esc_html__( 'Bold Title', 'kavehTheme' ),
			'type' => \Elementor\Controls_Manager::TEXT,
			'default' => esc_html__( 'Main Title' , 'kavehTheme' ),
    
        ]
    );
      $this->add_control(
        'titleheadingwtbuttonkaveh',
        [
            'label' => esc_html__( 'Main Title', 'kavehTheme' ),
			'type' => \Elementor\Controls_Manager::TEXT,
			'default' => esc_html__( 'Main Title' , 'kavehTheme' ),
    
        ]
    );
    $this->add_control(
      'tagheading2headingwtbuttonkaveh',
      [
        'label' => esc_html__( 'Main Title Tag', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'H3',
        'options' => [
          'H1'  => esc_html__( 'H1', 'kavehTheme' ),
          'H2' => esc_html__( 'H2', 'kavehTheme' ),
          'H3' => esc_html__( 'H3', 'kavehTheme' ),
          'H4' => esc_html__( 'H4', 'kavehTheme' ),
          'H5' => esc_html__( 'H5', 'kavehTheme' ),
          'H6' => esc_html__( 'H6', 'kavehTheme' ),
          'p' => esc_html__( 'p', 'kavehTheme' ),
          'div' => esc_html__( 'div', 'kavehTheme' ),
          'span' => esc_html__( 'span', 'kavehTheme' ),
        ],
      ]
    );

    $this->add_control(
      'buttons2headingwtbuttonkaveh',
      [
          'label' => esc_html__( 'Button Title', 'kavehTheme' ),
			'type' => \Elementor\Controls_Manager::TEXT,
			'default' => esc_html__( 'Products', 'kavehTheme' ),

      ]
    );
    $this->add_control(
    'iconbutts2headingwtbuttonkaveh',
    [
      'label' => esc_html__( 'Icon', 'kavehTheme' ),
      'type' => \Elementor\Controls_Manager::ICONS,
      'skin' => 'inline',
      'exclude_inline_options' => [ 'svg' ],
      'default' => [
        'value' => 'icon-arrow-left-2',
      ],
    ]
    );
    $this->add_control(
    'linkbuttons2headingwtbuttonkaveh',
    [
        'label' => esc_html__( 'Button Link', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__( '#', 'kavehTheme' ),

    ]
    );

        $this->end_controls_section();
        $this->start_controls_section(
          'styleheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Title Style', 'kavehTheme' ),
            'tab' => \Elementor\Controls_Manager::TAB_STYLE,
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Typography::get_type(),
          [
            'name' => 'title1_headingwtbuttonkaveh',
            'label' => esc_html__( 'Subtitle Typography', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .section-heading-nine .title-en',
          ]
        );
        $this->add_control(
          't1colorheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Subtitle Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine .title-en' => 'color: {{VALUE}}',
            ],
          ]
        );
        $this->add_control(
          't2colorbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Bold Title Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine .title b' => 'color: {{VALUE}}',
            ],
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Typography::get_type(),
          [
            'name' => 'title2headingwtbuttonkaveh',
            'label' => esc_html__( 'Main Title Typography', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .section-heading-nine .title',
          ]
        );
        $this->add_control(
          't2colorheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Main Title Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine .title' => 'color: {{VALUE}}',
            ],
          ]
        );


        $this->end_controls_section();
        $this->start_controls_section(
          'styleb_headingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Button Style', 'kavehTheme' ),
            'tab' => \Elementor\Controls_Manager::TAB_STYLE,
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Typography::get_type(),
          [
            'name' => 'button_nchbheadingwtbuttonkaveh',
            'label' => esc_html__( 'Button Text Typography', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .section-heading-nine a',
          ]
        );
        $this->add_control(
          'iconsizenchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Icon Size', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::SLIDER,
            'size_units' => [ 'px' ],
            'range' => [
              'px' => [
                'min' => 0,
                'max' => 200,
                'step' => 1,
              ],
            ],
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a i' => 'font-size: {{SIZE}}{{UNIT}};',
            ],
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Text_Shadow::get_type(),
          [
            'name' => 'text_shadownchbheadingwtbuttonkaveh',
            'label' => esc_html__( 'Text Shadow', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .section-heading-nine a',
          ]
        );
        $this->start_controls_tabs(
          'style_tabsnchbheadingwtbuttonkaveh'
        );
        
        $this->start_controls_tab(
          'style_normal_tabnchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Normal', 'kavehTheme' ),
          ]
        );
        $this->add_control(
          'textbuttoncolornchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Button Text Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a' => 'color: {{VALUE}}',
            ],
          ]
        ); 
        $this->add_control(
          'iconcolornchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Icon Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a i' => 'color: {{VALUE}}',
            ],
          ]
        ); 
        $this->add_control(
          'buttoncolornchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Button Background Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a::before' => 'background-color: {{VALUE}}',
  
            ],
          ]
        ); 
        
        $this->end_controls_tab();
        $this->start_controls_tab(
          'style_hove_tabnchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Hover', 'kavehTheme' ),
          ]
        );
        $this->add_control(
          'textbuttoncolorhovernchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Button Text Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a:hover' => 'color: {{VALUE}}',
            ],
          ]
        ); 
        $this->add_control(
          'iconcolorhovernchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Icon Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a:hover i' => 'color: {{VALUE}}',
            ],
          ]
        ); 
        $this->add_control(
          'buttoncolorhovernchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Button Background Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a:hover::before' => 'background-color: {{VALUE}}',
            ],
          ]
        ); 
        $this->end_controls_tab();
        $this->end_controls_tabs();
        $this->add_control(
          'hr1nchbheadingwtbuttonkaveh',
          [
            'type' => \Elementor\Controls_Manager::DIVIDER,
          ]
        );
        $this->add_control(
          'buttonpaddingnchbheadingwtbuttonkaveh',
          [
            'label' => esc_html__( 'Padding', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::DIMENSIONS,
            'size_units' => [ 'px' ],
            'selectors' => [
              '{{WRAPPER}} .section-heading-nine a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
            ],
          ]
        );
  
        $this->end_controls_section();

        }


  protected function render(){
    $settings = $this->get_settings_for_display();
    $clsid = $this->get_id();
  
?>

        <div class="section-heading-nine mx-auto w-100 text-center">
          <<?php echo  esc_attr($settings['tagheading1headingwtbuttonkaveh']); ?> class="title-en"> <?php echo  esc_html($settings['beforetitleheadingwtbuttonkaveh']); ?> </<?php echo  esc_attr($settings['tagheading1headingwtbuttonkaveh']); ?>>
          <<?php echo  esc_attr($settings['tagheading2headingwtbuttonkaveh']); ?> class="title">
            <b> <?php echo  esc_html($settings['titlebheadingwtbuttonkaveh']); ?></b>
            <?php echo  esc_html($settings['titleheadingwtbuttonkaveh']); ?>
          </<?php echo  esc_attr($settings['tagheading2headingwtbuttonkaveh']); ?>>
          <a href="<?php echo  esc_url($settings['linkbuttons2headingwtbuttonkaveh']); ?>" class="position-relative d-flex align-items-center">
            <?php echo  esc_html($settings['buttons2headingwtbuttonkaveh']); ?>
            <i class="<?php echo  esc_html($settings['iconbutts2headingwtbuttonkaveh']['value']); ?> ms-2"></i>
          </a>
        </div>

<style>
  <?php echo '.elementor-element-' . $clsid . ''; ?> .footer-name-shop::after {
    margin-top: 22px;
    }
</style> 
    <?php
  }


}
