File: //proc/thread-self/cwd/wp-content/plugins/ftech-plugin/elementor/widgets/header.php
<?php
/**
* Elementor Single Widget
* @package ftech Tools
* @since 1.0.0
*/
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
class Ftech_Header extends Widget_Base {
/**
* Get widget name.
*
* Retrieve Elementor widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'ftech-header';
}
/**
* Get widget title.
*
* Retrieve Elementor widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Ftech Header', 'ftech-plugin' );
}
/**
* Get widget icon.
*
* Retrieve Elementor widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'ftech-custom-icon';
}
/**
* Get widget categories.
*
* Retrieve the list of categories the Elementor widget belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'ftech_widgets' ];
}
protected function register_controls() {
$this->start_controls_section(
'print_header_layout',
[
'label' => esc_html__( 'Header Layout', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'style',
[
'label' => esc_html__( 'Style', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '1',
'options' => [
'1' => esc_html__( 'Header 1', 'ftech-plugin' ),
'2' => esc_html__( 'Header 2', 'ftech-plugin' ),
'3' => esc_html__( 'Header 3', 'ftech-plugin' ),
'4' => esc_html__( 'Header 4', 'ftech-plugin' ),
'5' => esc_html__( 'Header 5', 'ftech-plugin' ),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'menu_btn_select',
[
'label' => esc_html__( 'Header General Option', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'hide_offcanvas_menu',
[
'label' => esc_html__( 'Offcanvas HIDE/SHOW', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'ftech-plugin' ),
'label_off' => esc_html__( 'Hide', 'ftech-plugin' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'sear_hide_show',
[
'label' => esc_html__( 'Search HIDE/SHOW', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'ftech-plugin' ),
'label_off' => esc_html__( 'Hide', 'ftech-plugin' ),
'return_value' => 'yes',
'default' => 'yes',
'condition' => [
'style' => ['2'],
],
]
);
$this->add_control(
'search_text', [
'label' => esc_html__( 'Search Button Text', 'ftech-plugin' ),
'default' => esc_html__( 'Search', 'ftech-plugin' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'condition' => [
'style' => ['3'],
'sear_hide_show' => 'yes',
],
]
);
$this->add_control(
'btn_label', [
'label' => esc_html__( 'Header Button Label', 'ftech-plugin' ),
'default' => esc_html__( 'Let’s Talk', 'ftech-plugin' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'condition' => [
'style' => ['1', '2', '4', '5'],
],
]
);
$this->add_control(
'btn_link', [
'label' => esc_html__( 'Header Button Link', 'ftech-plugin' ),
'type' => Controls_Manager::URL,
'label_block' => true,
'condition' => [
'style' => ['1', '2', '4', '5'],
],
]
);
$this->add_control(
'phone_icon', [
'label' => esc_html__( 'Phone Icon', 'ftech-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
'condition' => [
'style' => ['2'],
],
]
);
$this->add_control(
'phone_no', [
'label' => esc_html__( 'Phone Number', 'ftech-plugin' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'condition' => [
'style' => ['2'],
],
]
);
$this->add_control(
'phone_link', [
'label' => esc_html__( 'Phone Link', 'ftech-plugin' ),
'type' => Controls_Manager::URL,
'label_block' => true,
'condition' => [
'style' => ['2'],
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'logoop',
[
'label' => esc_html__( 'Logo Option', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'rzlogo', [
'label' => esc_html__( 'Logo', 'ftech-plugin' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_responsive_control(
'logo_max_width',
[
'label' => esc_html__( 'Max Width', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 5000,
]
],
'selectors' => [
'{{WRAPPER}} .logo_site-size' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'menu_select',
[
'label' => esc_html__( 'Menu Option', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'choose-menu',
[
'label' => esc_html__( 'Choose menu', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SELECT2,
'options' => ftech_menu_selector(),
'multiple' => false
]
);
$this->end_controls_section();
$this->start_controls_section(
'mobile_menu_opt',
[
'label' => esc_html__( 'Mobile Option', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'mrzlogo', [
'label' => esc_html__( 'Mobile Logo', 'ftech-plugin' ),
'type' => Controls_Manager::MEDIA,
'label_block' => true,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_responsive_control(
'logo_max_m_width',
[
'label' => esc_html__( 'Max Width', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 5000,
]
],
'selectors' => [
'{{WRAPPER}} .logo img' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'icons', [
'label' => esc_html__( 'Icon', 'ftech-plugin' ),
'type' => Controls_Manager::ICONS,
'label_block' => true,
]
);
$repeater->add_control(
'link', [
'label' => esc_html__( 'Link', 'ftech-plugin' ),
'type' => Controls_Manager::URL,
'label_block' => true,
]
);
$this->add_control(
'socials',
[
'label' => esc_html__( 'Add Social Item', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'default' => [
[
'icons' => [
'value' => 'fab fa-facebook-f',
'library' => 'solid',
],
'name' => esc_html__( 'Facebook', 'ftech-plugin' ),
'link' => esc_html__( 'https://facebook.com', 'ftech-plugin' ),
],
[
'icons' => [
'value' => 'fab fa-instagram',
'library' => 'solid',
],
'name' => esc_html__( 'Instagram', 'ftech-plugin' ),
'link' => esc_html__( 'https://instagram.com', 'ftech-plugin' ),
],
[
'icons' => [
'value' => 'fab fa-youtube',
'library' => 'solid',
],
'name' => esc_html__( 'Youtube', 'ftech-plugin' ),
'link' => esc_html__( 'https://youtube.com', 'ftech-plugin' ),
],
[
'icons' => [
'value' => 'fab fa-linkedin',
'library' => 'solid',
],
'name' => esc_html__( 'Linkedin', 'ftech-plugin' ),
'link' => esc_html__( 'https://linkedin.com', 'ftech-plugin' ),
]
],
'fields' => $repeater->get_controls(),
'title_field' => '{{{ name }}}',
]
);
$this->add_control(
'gallery',
[
'label' => esc_html__( 'Add Images', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::GALLERY,
'show_label' => false,
'default' => [],
]
);
$this->end_controls_section();
$this->start_controls_section(
'menu_bar_style',
[
'label' => esc_html__( 'Menu Style', 'ftech-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'--menu--style-info',
[
'label' => esc_html__( 'Menu Style', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'menu_color',
[
'label' => esc_html__( 'Menu Color', 'ftech-plugin' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .main-navigation .navbar-nav li a' => 'color: {{VALUE}}'
],
]
);
$this->add_control(
'menu_color-hover',
[
'label' => esc_html__( 'Menu Hover Color', 'ftech-plugin' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .main-navigation .navbar-nav li:hover > a' => 'color: {{VALUE}}',
'{{WRAPPER}} .main-navigation .navbar-nav li a::after' => 'background-color: {{VALUE}}'
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'menu_fb_typography',
'selector' => '
{{WRAPPER}} .main-navigation .navbar-nav li a
',
]
);
$this->add_control(
'menu_dropdown_style',
[
'label' => esc_html__( 'Menu Dropdown Style', 'ftech-plugin' ),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'mdb_color',
[
'label' => esc_html__( 'Dropdown Box BG Color', 'ftech-plugin' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .main-navigation .navbar-nav li .dropdown-menu' => 'background: {{VALUE}}'
],
]
);
$this->add_control(
'mdb_menu_color',
[
'label' => esc_html__( 'Dropdown Box Border Color', 'ftech-plugin' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .main-navigation .navbar-nav li .dropdown-menu' => 'border-color: {{VALUE}}'
],
]
);
$this->end_controls_section();
// feature style
$this->start_controls_section(
'--button_one',
[
'label' => esc_html__( 'Button Style', 'goyto-plugin' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'm_b_typography',
'selector' => '
{{WRAPPER}} .ftc-btn-1,
{{WRAPPER}} .ftc-btn-3
',
]
);
$this->add_control(
'padding',
[
'label' => esc_html__( 'Padding', 'goyto-plugin' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .ftc-btn-1' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .ftc-btn-3' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
]
);
$this->add_control(
'b_round',
[
'label' => esc_html__( 'Border Radius', 'goyto-plugin' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .ftc-btn-1' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .ftc-btn-3' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
]
);
$this->start_controls_tabs(
'style_tabs'
);
$this->start_controls_tab(
'style_normal_tab',
[
'label' => esc_html__( 'Normal', 'goyto-plugin' ),
]
);
$this->add_control(
'btn_text',
[
'label' => esc_html__( 'Text Color', 'goyto-plugin' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ftc-btn-1' => 'color: {{VALUE}}',
'{{WRAPPER}} .ftc-btn-3' => 'color: {{VALUE}}'
],
]
);
$this->add_control(
'btn_border_text',
[
'label' => esc_html__( 'Button Border Color', 'goyto-plugin' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ftc-btn-3::after' => 'border-color: {{VALUE}}'
],
'condition' => [
'style' => '4',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'button_bg_color',
'types' => [ 'gradient' ],
'exclude' => [ 'image' ],
'selector' => '
{{WRAPPER}} .ftc-btn-1,
{{WRAPPER}} .ftc-btn-3
',
'fields_options' => [
'background' => [
'label' => esc_html__( 'Button BG Color ', 'goyto-plugin' ),
'description' => esc_html__( 'Choose background type and style.', 'goyto-plugin' ),
'separator' => 'before',
]
]
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'style_hover_tab',
[
'label' => esc_html__( 'Hover', 'goyto-plugin' ),
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'button_bg_hover_color',
'types' => [ 'gradient' ],
'exclude' => [ 'image' ],
'selector' => '
{{WRAPPER}} .ftc-btn-1::after,
{{WRAPPER}} .ftc-btn-3::before
',
'fields_options' => [
'background' => [
'label' => esc_html__( 'Button Hover BG Color ', 'goyto-plugin' ),
'description' => esc_html__( 'Choose background type and style.', 'goyto-plugin' ),
'separator' => 'before',
]
]
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
extract( $settings );
if ( ! empty( $settings['btn_link']['url'] ) ) {
$this->add_link_attributes( 'btn_link', $settings['btn_link'] );
}
require __DIR__ . '/view/header/header-' . $style . '.php';
}
/**
* Search Body Display
*
* @return void
*/
protected function ___search_body(){
$settings = $this->get_settings_for_display();
?>
<div class="popup-search-box search_1_popup_active ">
<div class="container">
<?php if(!empty($settings['search_title'])):?>
<h4 class="title gtb-heading-1"><?php echo esc_html($settings['search_title']);?></h4>
<?php endif;?>
<div class="popup-search-box-form">
<form action="<?php echo esc_url(home_url( '/' ));?>">
<div class="popup-search-box-input">
<input class="search-input" type="search" placeholder="<?php esc_attr_e( 'Search Keywords..', 'ftech-plugin' );?>" value="<?php echo get_search_query();?>">
</div>
<button aria-label="search" type="submit"><i class="fal fa-search"></i></button>
</form>
<button aria-label="search" type="button" class="popup-search-box-close-action-btn search_1_popup_close"><i class="fal fa-times"></i></button>
</div>
</div>
</div>
<?php
}
/**
* Mobile Menu Display
*
* @return void
*/
protected function __mobile_menu(){
$settings = $this->get_settings_for_display();
?>
<div class="mobile-menu lenis lenis-smooth" >
<div class="mobile-menu-wrap">
<div class="mobile-menu-bg">
<span class="span1" ></span>
<span class="span2" ></span>
</div>
<div class="mobile-menu-logo-wrap mb-100">
<a class="mobile-menu-logo d-block" href="<?php if(!empty($settings['logolink']['url'])){echo esc_url($settings['logolink']['url']);}else{echo esc_url(home_url( '/' ));} ?>"><img src="<?php echo esc_url($settings['mrzlogo']['url']);?>" alt="<?php if(!empty($settings['mrzlogo']['alt'])){ echo esc_attr($settings['mrzlogo']['alt']);}else{esc_attr_e('Shape', 'gtbus-plugin');}?>"></a>
<div class="mobile-menu-close" id="menuToggle2">
<i class="fa-duotone fa-circle-xmark"></i>
</div>
</div>
<div class="mobile-menu-inner">
<!-- mobile-menu-list -->
<div class="mobile-menu-navigation mb-50">
<nav class="mobile-main-navigation clearfix ul-li">
<?php
echo str_replace(['menu-item-has-children', 'sub-menu'], ['dropdown', 'dropdown-menu clearfix'], wp_nav_menu( array(
'echo' => false,
'menu' => !empty($settings['choose-menu']) ? $settings['choose-menu'] : 'menu-1',
'menu_id' =>'main-nav',
'menu_class' =>'nav navbar-nav clearfix',
'container'=>false,
'fallback_cb' => 'Navwalker_Class::fallback',
'walker' => class_exists( 'Rs_Mega_Menu_Walker' ) ? new \Rs_Mega_Menu_Walker : '',
)) );
?>
</nav>
</div>
<!-- search-form -->
<div class="mobile-menu-search-bar">
<form action="<?php echo esc_url(home_url( '/' ));?>" class="mobile-menu-search-form-1 mb-50" >
<input type="text" name="search" placeholder="<?php esc_attr_e( 'Search Etc..', 'gtbus-plugin' );?>" value="<?php echo get_search_query();?>">
<button class="form-btn" type="button" aria-label="name" >
<i class="fa-solid fa-magnifying-glass"></i>
<?php esc_html_e('search', 'ftech-plugin') ?>
</button>
</form>
</div>
<!-- social-link -->
<div class="mobile-menu-socail-link">
<div class="mobile-menu-social-1 d-flex align-items-center flex-wrap">
<?php foreach($settings['socials'] as $item):?>
<a href="<?php echo esc_url($item['link']['url'])?>" aria-label="social link" ><?php \Elementor\Icons_Manager::render_icon( $item['icons'], [ 'aria-hidden' => 'true' ] ); ?></a>
<?php endforeach;?>
</div>
</div>
</div>
</div>
</div>
<?php }
}
Plugin::instance()->widgets_manager->register( new Ftech_Header() );