<?php



use Elementor\Widget_Base;
use Elementor\Controls_Manager;

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


class Headingkaveh extends Widget_Base{

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

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

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

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

  protected function register_controls(){
    
    $this->start_controls_section(
        'contentheadingkaveh',
        [
          'label' => esc_html__( 'Element Content', 'kavehTheme' ),
                  'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        ]
      );
      $this->add_control(
        'styledotheadingkaveh',
        [
          'label' => esc_html__( 'Element Style', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::SELECT,
          'default' => 'one',
          'options' => [
            'one'  => esc_html__( 'Style One', 'kavehTheme' ),
            'two'  => esc_html__( 'Style Two', 'kavehTheme' ),
            'three'  => esc_html__( 'Style Three', 'kavehTheme' ),
            'four'  => esc_html__( 'Style Four', 'kavehTheme' ),
            'five'  => esc_html__( 'Style Five', 'kavehTheme' ),
          ],
        ]
        ); 
        $this->add_control(
          'beforetitleheadingkaveh',
          [
              'label' => esc_html__( 'Subtitle', 'kavehTheme' ),
              'type' => \Elementor\Controls_Manager::TEXT,
              'default' => esc_html__( 'Subtitle', 'kavehTheme' ),
              'condition' => [
                'styledotheadingkaveh' => ['two','three','four','five' ],
              ],
      
          ]
      );
      $this->add_control(
        'tagheading1headingkaveh',
        [
          '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' ),
          ],
          'condition' => [
            'styledotheadingkaveh' => 'two',
          ],
        ]
      );
      $this->add_control(
        'titleheadingkaveh',
        [
            'label' => esc_html__( 'Main Title', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::TEXT,
            'default' => esc_html__( 'Main Title' , 'kavehTheme' ),
    
        ]
    );
    $this->add_control(
      'tagheading2headingkaveh',
      [
        '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(
      'titlelinkheadingkaveh',
      [
          'label' => esc_html__( 'Link', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::TEXT,
          'default' => esc_html__( '#' , 'kavehTheme' ),
          'condition' => [
            'styledotheadingkaveh!' => ['four','five'],
          ],
  
      ]
  );  
  $this->add_control(
    'title3headingkaveh',
    [
        'label' => esc_html__( 'Subtitle', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__( 'Subtitle' , 'kavehTheme' ),
        'condition' => [
            'styledotheadingkaveh' => 'five',
          ],

    ]
);
$this->add_control(
  'tagheading3headingkaveh',
  [
    'label' => esc_html__( 'Subtitle Tag', 'kavehTheme' ),
    'type' => \Elementor\Controls_Manager::SELECT,
    'default' => 'H3',
    'condition' => [
            'styledotheadingkaveh' => 'five',
          ],
    '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(
    'desc3headingkaveh',
    [
        'label' => esc_html__( 'Description', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__( 'Special sale of various sunglasses brands' , 'kavehTheme' ),
        'condition' => [
            'styledotheadingkaveh' => 'five',
          ],

    ]
);
  $this->add_control(
    'text_alignheadingkaveh',
    [
      'label' => esc_html__( 'Alignment', 'kavehTheme' ),
      'type' => \Elementor\Controls_Manager::CHOOSE,
      'options' => [
        'left' => [
          'title' => esc_html__( 'Left Align', 'kavehTheme' ),
          'icon' => 'eicon-text-align-left',
        ],
        'center' => [
          'title' => esc_html__( 'Center Align', 'kavehTheme' ),
          'icon' => 'eicon-text-align-center',
        ],
        'right' => [
          'title' => esc_html__( 'Right Align', 'kavehTheme' ),
          'icon' => 'eicon-text-align-right',
        ],
      ],
      'condition' => [
        'styledotheadingkaveh!' => ['one','five'],
      ],
      'toggle' => true,
    ]
  );
        $this->end_controls_section();
        $this->start_controls_section(
          'styleheadingkaveh',
          [
            'label' => esc_html__( 'Title Style', 'kavehTheme' ),
            'tab' => \Elementor\Controls_Manager::TAB_STYLE,
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Typography::get_type(),
          [
            'name' => 'title1_headingkaveh',
            'label' => esc_html__( 'Subtitle Typography', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .headfkaveh',
            'condition' => [
              'styledotheadingkaveh' => ['two','three','four' ],
            ],
          ]
        );
        $this->add_control(
          't1colorheadingkaveh',
          [
            'label' => esc_html__( 'Subtitle Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .headfkaveh' => 'color: {{VALUE}}',
              'condition' => [
                'styledotheadingkaveh' => ['two','three','four' ],
              ],
            ],
          ]
        );
        $this->add_group_control(
          \Elementor\Group_Control_Typography::get_type(),
          [
            'name' => 'title2headingkaveh',
            'label' => esc_html__( 'Main Title Typography', 'kavehTheme' ),
            'selector' => '{{WRAPPER}} .headkaveh',
          ]
        );
        $this->add_control(
          't2colorheadingkaveh',
          [
            'label' => esc_html__( 'Main Title Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .headkaveh' => 'color: {{VALUE}}',
            ],
          ]
        );
        $this->add_control(
          'mtheadingkaveh',
          [
            'label' => esc_html__( 'Shape Distance from Top', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::SLIDER,
            'size_units' => [ 'px', '%' ],
            'condition' => [
              'styledotheadingkaveh' => 'one',
            ],
            'range' => [
              'px' => [
                'min' => -200,
                'max' => 200,
                'step' => 1,
              ],
              '%' => [
                'min' => -50,
                'max' => 50,
              ],
            ],
            'default' => [
              'unit' => 'px',
              'size' => 22,
            ],
            'selectors' => [
              '{{WRAPPER}} .footer-name-shop::after' => 'margin-top: {{SIZE}}{{UNIT}};',
            ],
          ]
        );
        $this->add_control(
          't1shapebgcolorheadingkaveh',
          [
            'label' => esc_html__( 'Shape Color', 'kavehTheme' ),
            'condition' => [
              'styledotheadingkaveh' => 'one',
            ],
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .footer-name-shop::after' => 'background-color: {{VALUE}}',
            ],
          ]
        );
        $this->add_control(
          't3shapebgcolorheadingkaveh',
          [
            'label' => esc_html__( 'Shape Color', 'kavehTheme' ),
            'condition' => [
              'styledotheadingkaveh' => 'three',
            ],
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
              '{{WRAPPER}} .footer-three-titr::before' => 'background-color: {{VALUE}}',
            ],
          ]
        );

$this->add_group_control(
  \Elementor\Group_Control_Typography::get_type(),
  [
    'name' => 'title3headingkaveh',
    'label' => esc_html__( 'Subtitle Typography', 'kavehTheme' ),
    'selector' => '{{WRAPPER}} .zheadkaveh',
    'condition' => [
      'styledotheadingkaveh' => 'five',
    ],
  ]
);
$this->add_control(
  't3colorheadingkaveh',
  [
    'label' => esc_html__( 'Subtitle Color', 'kavehTheme' ),
    'type' => \Elementor\Controls_Manager::COLOR,
    'condition' => [
      'styledotheadingkaveh' => 'five',
    ],
    'selectors' => [
      '{{WRAPPER}} .zheadkaveh' => 'color: {{VALUE}}',
    ],
  ]
);
$this->add_group_control(
  \Elementor\Group_Control_Typography::get_type(),
  [
    'name' => 'desc4headingkaveh',
    'label' => esc_html__( 'Description Typography', 'kavehTheme' ),
    'condition' => [
      'styledotheadingkaveh' => 'five',
    ],
    'selector' => '{{WRAPPER}} .deskaveh',
  ]
);
$this->add_control(
  'des4colorheadingkaveh',
  [
    'label' => esc_html__( 'Description Color', 'kavehTheme' ),
    'type' => \Elementor\Controls_Manager::COLOR,
    'condition' => [
      'styledotheadingkaveh' => 'five',
    ],
    'selectors' => [
      '{{WRAPPER}} .deskaveh' => 'color: {{VALUE}}',
    ],
  ]
);
        $this->end_controls_section();
          
        }


  protected function render(){
    $settings = $this->get_settings_for_display();
    $clsid = $this->get_id();
  
?>
          <?php if('one'===$settings['styledotheadingkaveh']){ ?>
            <a href="<?php echo  esc_url($settings['titlelinkheadingkaveh']); ?>" class="footer-name-shop position-relative <?php if("left"===$settings['text_alignheadingkaveh']){ ?>text-end<?php }elseif("center"===$settings['text_alignheadingkaveh']){ ?>text-center<?php }elseif("right"===$settings['text_alignheadingkaveh']){ ?>text-right<?php } ?>"><<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?> class="headkaveh"><?php echo  esc_html($settings['titleheadingkaveh']); ?></<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?>></a>
          <?php }elseif('two'===$settings['styledotheadingkaveh']){ ?>
              <div class="section-heading">
          <div class="detail">
            <a href="<?php echo  esc_url($settings['titlelinkheadingkaveh']); ?>" class="<?php if("left"===$settings['text_alignheadingkaveh']){ ?>text-end<?php }elseif("center"===$settings['text_alignheadingkaveh']){ ?>text-center<?php }elseif("right"===$settings['text_alignheadingkaveh']){ ?>text-right<?php } ?>">
            <<?php echo  esc_attr($settings['tagheading1headingkaveh']); ?> class="section-heading-sub-title headfkaveh"><?php echo  esc_html($settings['beforetitleheadingkaveh']); ?></<?php echo  esc_attr($settings['tagheading1headingkaveh']); ?>>
            <<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?> class="section-heading-title headkaveh"><?php echo  esc_html($settings['titleheadingkaveh']); ?></<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?>>
            </a>
          </div>
          </div>
          <?php }elseif('three'===$settings['styledotheadingkaveh']){ ?>
            <a href="<?php echo  esc_url($settings['titlelinkheadingkaveh']); ?>" class="<?php if("left"===$settings['text_alignheadingkaveh']){ ?>text-end<?php }elseif("center"===$settings['text_alignheadingkaveh']){ ?>text-center<?php }elseif("right"===$settings['text_alignheadingkaveh']){ ?>text-right<?php } ?>">
            <<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?> class="footer-three-titr headfkaveh">
            <?php echo  esc_html($settings['beforetitleheadingkaveh']); ?>
              <span class="headkaveh"><?php echo  esc_html($settings['titleheadingkaveh']); ?></span>
            </<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?>>
            </a>
            <?php }elseif('four'===$settings['styledotheadingkaveh']){ ?>
          <div class="footer-four">
            <<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?> class="titr headkaveh <?php if("left"===$settings['text_alignheadingkaveh']){ ?>text-end<?php }elseif("center"===$settings['text_alignheadingkaveh']){ ?>text-center<?php }elseif("right"===$settings['text_alignheadingkaveh']){ ?>text-right<?php } ?>"> <b class="headfkaveh"><?php echo  esc_html($settings['beforetitleheadingkaveh']); ?></b> <?php echo  esc_html($settings['titleheadingkaveh']); ?></<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?>>
          </div>
          <?php }elseif('five'===$settings['styledotheadingkaveh']){ ?>
            <div class="about-us-landing">
            <div class="content position-relative about-us-landing">
              <<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?> class="title mb-0 headkaveh"> <span class="headfkaveh"> <?php echo  esc_html($settings['beforetitleheadingkaveh']); ?> </span> <?php echo  esc_html($settings['titleheadingkaveh']); ?> </<?php echo  esc_attr($settings['tagheading2headingkaveh']); ?>>
              <<?php echo  esc_attr($settings['tagheading3headingkaveh']); ?> class="sub-title zheadkaveh"> <?php echo  esc_html($settings['title3headingkaveh']); ?></<?php echo  esc_attr($settings['tagheading3headingkaveh']); ?>>
              <div class="description position-relative deskaveh"> <?php echo  esc_html($settings['desc3headingkaveh']); ?></div>
            </div>
            </div>
            <?php }?>
<style>
  <?php echo '.elementor-element-' . $clsid . ''; ?> .footer-name-shop::after {
    margin-top: 22px;
    }
</style> 
    <?php
  }


}
