start_controls_section( 'section_menu_type', [ 'label' => esc_html__( 'Global', 'nighty' ), ] ); $menus = \wp_get_nav_menus(); $list_menu = array(); foreach ($menus as $menu) { $list_menu[$menu->slug] = $menu->name; } $this->add_control( 'menu_slug', [ 'label' => esc_html__( 'Select Menu', 'nighty' ), 'type' => Controls_Manager::SELECT, 'options' => $list_menu, 'default' => '', 'prefix_class' => 'elementor-view-', ] ); $this->add_control( 'icon', [ 'label' => esc_html__( 'Decoration Icon', 'nighty' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [ 'value' => 'flaticon flaticon-expand', 'library' => 'flaticon', ], ] ); $this->end_controls_section(); /* Parent Menu Section *******************************/ /***********************************************/ $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Parent Menu', 'nighty' ), ] ); // Typography Parent Menu $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'menu_typography', 'selector' => '{{WRAPPER}} ul li a' ] ); $this->add_responsive_control( 'menu_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} ul' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'menu_a_padding', [ 'label' => esc_html__( 'Content Padding', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); // Control Tabs $this->start_controls_tabs( 'style_parent_menu_tabs' ); // Normal Tab $this->start_controls_tab( 'style_parent_menu_normal_tab', [ 'label' => esc_html__( 'Normal', 'nighty' ), ] ); $this->add_control( 'link_color', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.menu > li > a' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); // Hover Tab $this->start_controls_tab( 'style_parent_menu_hover_tab', [ 'label' => esc_html__( 'Hover', 'nighty' ), ] ); $this->add_control( 'link_color_hover', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.menu > li > a:hover' => 'color: {{VALUE}};', ] ] ); $this->end_controls_tab(); // Active Tab $this->start_controls_tab( 'style_parent_menu_active_tab', [ 'label' => esc_html__( 'Active', 'nighty' ), ] ); $this->add_control( 'link_color_active', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.menu > li.current-menu-item > a' => 'color: {{VALUE}};', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); /* Sub Menu Section *******************************/ /***********************************************/ $this->start_controls_section( 'section_submenu_content', [ 'label' => esc_html__( 'Sub Menu', 'nighty' ), ] ); // Typography SubMenu $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'submenu_typography', 'selector' => '{{WRAPPER}} ul.sub-menu li a' ] ); // Background Submenu $this->add_control( 'submenu_bg_color', [ 'label' => esc_html__( 'Background', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.sub-menu' => 'background-color: {{VALUE}};', ] ] ); // Background Item Hover In Submenu $this->add_control( 'submenu_bg_item_hover_color', [ 'label' => esc_html__( 'Background Item Hover', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.sub-menu li a:hover' => 'background-color: {{VALUE}};', ] ] ); // Control Tabs $this->start_controls_tabs( 'style_sub_menu_tabs' ); // Normal Tab $this->start_controls_tab( 'style_sub_menu_normal_tab', [ 'label' => esc_html__( 'Normal', 'nighty' ), ] ); $this->add_control( 'submenu_link_color', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.sub-menu li a' => 'color: {{VALUE}};', ] ] ); $this->end_controls_tab(); // Hover Tab $this->start_controls_tab( 'style_sub_menu_hover_tab', [ 'label' => esc_html__( 'Hover', 'nighty' ), ] ); $this->add_control( 'submenu_link_color_hover', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.sub-menu li a:hover' => 'color: {{VALUE}};', ] ] ); $this->end_controls_tab(); // Active Tab $this->start_controls_tab( 'style_sub_menu_active_tab', [ 'label' => esc_html__( 'Active', 'nighty' ), ] ); $this->add_control( 'submenu_link_color_active', [ 'label' => esc_html__( 'Menu Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} ul.sub-menu li.current-menu-item > a' => 'color: {{VALUE}};', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render the widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * * @access protected */ protected function render() { $settings = $this->get_settings(); ?> register( new Nighty_Elementor_Menu_Nav() );