/
home
/
rekodeb
/
webmars
/
wp-content
/
plugins
/
calmor-core
/
widgets
/
Upload File
HOME
<?php namespace calmorCore\Widgets; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Background; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use calmor_Navwalker; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Text Typing Effect * * Elementor widget for text typing effect. * * @since 1.7.0 */ class calmer_navmenu extends Widget_Base { public function get_name() { return 'calmor-navmenu'; } public function get_title() { return __( 'Calmer Nav Menu', 'calmor-core' ); } public function get_icon() { return 'eicon-device-desktop'; } public function get_categories() { return [ 'calmor-elements' ]; } protected function register_controls() { $this->start_controls_section( 'drdt_site_logo_sections', [ 'label' => __( 'Logo', 'calmer-core' ), ] ); $this->add_control( 'use_logo_custom', [ 'label' => esc_html__( 'Use Custom Logo', 'calmer-core' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'calmer-core' ), 'label_off' => esc_html__( 'No', 'calmer-core' ), 'return_value' => 'yes', 'default' => '', ] ); $this->add_control( 'main_logo', [ 'label' => __( 'Main Logo', 'calmer-core' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'use_logo_custom' => 'yes' ] ] ); $this->add_control( 'sticky_logo', [ 'label' => __( 'Sticky Logo', 'calmer-core' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'use_logo_custom' => 'yes' ] ] ); $this->add_control( 'logo_max_width', [ 'label' => __( 'Max Width', 'calmer-core' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .drdt_custom_site_logo img' => 'max-width: {{SIZE}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'main_logo_alignment', [ 'label' => __( 'Alignment', 'calmer-core' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'calmer-core' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'calmer-core' ), 'icon' => 'eicon-text-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'calmer-core' ), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'left', 'selectors' => [ '{{WRAPPER}} .drdt_site_logo' => 'justify-content: {{VALUE}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title', [ 'label' => __( 'button Info', 'calmor-core' ), ] ); $this->add_control( 'button_level', [ 'label' => esc_html__( 'Button Text', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'View More', ] ); $this->add_control( 'button_url', [ 'label' => esc_html__( 'Button URL', 'calmer-core' ), 'type' => \Elementor\Controls_Manager::URL, 'options' => [ 'url', 'is_external', 'nofollow' ], 'default' => [ 'url' => '', 'is_external' => true, 'nofollow' => true, // 'custom_attributes' => '', ], 'label_block' => true, ] ); $this->end_controls_section(); /// Menu Style $this->start_controls_section( 'menu_style', [ 'label' => __( 'Menu Style', 'calmor-core' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE ] ); $this->add_control( 'menu_bg_color', [ 'label' => esc_html__( 'Background Color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} nav.navbar.navbar-expand-lg.menu_two' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'menu_typo', 'selector' => ' {{WRAPPER}} .custom_menu .menu>.nav-item>.nav-link', ] ); $this->add_control( 'main_menu_color', [ 'label' => esc_html__( 'Menu color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .custom_menu .menu>.nav-item>.nav-link' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'main_menu_active_hover_color', [ 'label' => esc_html__( 'Menu Active/Hover color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .menu_two .menu>.nav-item:hover .nav-link, .menu_two .menu>.nav-item.active .nav-link' => 'color: {{VALUE}};', '{{WRAPPER}} .menu>.nav-item>.nav-link:before' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'sub_menu_bg_color', [ 'label' => esc_html__( 'Sub Menu BG Color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .custom_menu .menu>.nav-item.submenu .dropdown-menu' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'sub_main_menu_color', [ 'label' => esc_html__( 'Sub Menu color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .custom_menu .menu>.nav-item.submenu .dropdown-menu .nav-item .nav-link' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'sub_main_menu_hover_color', [ 'label' => esc_html__( 'Sub Menu Hover color', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .custom_menu .menu>.nav-item.submenu .dropdown-menu .nav-item:hover>.nav-link' => 'color: {{VALUE}};', ], ] ); $this->end_controls_section(); /// Menu end Style // Button Style $this->start_controls_section( 'section_button_style', [ 'label' => __( 'button Style', 'calmer-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->start_controls_tabs( 'style_tabs' ); //button Style Normal Style $this->start_controls_tab( 'style_normal', [ 'label' => __( 'Normal', 'calmor-core' ), ] ); $this->add_control( 'btn_font_color', [ 'label' => esc_html__( 'Font color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn_color' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'btn_bg_color', [ 'label' => esc_html__( 'Background Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn_color' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => esc_html__( 'Border', 'calmor-core' ), 'selector' => '{{WRAPPER}} .bg_btn_color', ] ); $this->add_responsive_control( 'button_border_radius', [ 'label' => esc_html__('Border Radius', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .bg_btn_color' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'button_border_margin', [ 'label' => esc_html__('Margin', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .calmer_button .bg_btn_color' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'button_border_padding', [ 'label' => esc_html__('Padding', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .calmer_button .bg_btn_color' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); //Hover Color $this->start_controls_tab( 'style_hover_btn', [ 'label' => __( 'Hover', 'calmor-core' ), ] ); $this->add_control( 'hover_font_color', [ 'label' => __( 'Font Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .calmer_button.bg_btn_color:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'hover_bg_color', [ 'label' => __( 'Background Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .calmer_button.bg_btn_color:hover' => 'background: {{VALUE}};', ] ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'hover_button_border', 'label' => esc_html__( 'Border', 'calmor-core' ), 'selector' => '{{WRAPPER}} .bg_btn_color:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); extract($settings); $opt = get_option('calmor_opt'); $logo = isset( $opt['logo']['url'] ) ? $opt['logo']['url'] : CALMOR_IMAGES.'/default_logo/logo.png'; $logo_sticky = isset( $opt['sticky_logo']['url'] ) ? $opt['sticky_logo']['url'] : CALMOR_IMAGES.'/default_logo/logo_sticky.png'; if ( ! empty( $settings['button_url']['url'] ) ) { $this->add_link_attributes( 'button_url', $settings['button_url'] ); } ?> <nav class="navbar navbar-expand-lg menu_two"> <div class="container header_menu"> <?php if($settings['use_logo_custom'] == 'yes') { ?> <div class="navbar-brand"> <a href="<?php echo esc_url( home_url( '/' ) ) ?>" class="navbar-brand"> <img class="site-logo" src="<?php echo esc_url($main_logo['url']); ?>"> <img class="site-logo" src="<?php echo esc_url($sticky_logo['url']); ?>"> </a> </div> <?php }else{ ?> <div class="navbar-brand"> <a href="<?php echo esc_url( home_url( '/' ) ) ?>" class="navbar-brand"> <img class="site-logo" src="<?php echo esc_url($logo); ?>"> <img class="site-logo" src="<?php echo esc_url($logo_sticky); ?>"> </a> </div> <?php } ?> <div class="collapse navbar-collapse justify-content-center custom_menu" id="navbarSupportedContent"> <?php wp_nav_menu( array( 'menu_class' => 'navbar-nav menu', 'container' => '', 'theme_location' => 'main_menu', 'walker' => new calmor_Navwalker(), 'fallback_cb' => false, ) ); ?> </div> <?php if($settings['button_level']): ?> <div class="calmer_button"> <a <?php echo $this->get_render_attribute_string( 'button_url' ); ?> class="bg_btn_color wow fadeInLeft" data-wow-delay=".3s"><?php echo $settings['button_level']; ?></a> </div> <?php endif; ?> <button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span></span><span></span><span></span><span></span><span></span><span></span> </button> </div> </nav> <?php } }