start_controls_section(
'section_layout',
array(
'label' => esc_html__('Layout', 'advanced-menu-builder-for-elementor'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
)
);
// Menu Name (Label per user image)
$this->add_control(
'menu_label_text',
array(
'label' => esc_html__('Menu Name', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__('Menu', 'advanced-menu-builder-for-elementor'),
'placeholder' => esc_html__('Menu', 'advanced-menu-builder-for-elementor'),
)
);
$menus = $this->get_available_menus();
if (!empty($menus)) {
$this->add_control(
'menu',
array(
'label' => esc_html__('Menu', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => $menus,
'default' => array_keys($menus)[0],
'save_default' => true,
// translators: %s: URL to the Menus screen.
'description' => sprintf(__('Go to the Menus screen to manage your menus.', 'advanced-menu-builder-for-elementor'), admin_url('nav-menus.php')),
)
);
} else {
$this->add_control(
'menu_error',
array(
'type' => \Elementor\Controls_Manager::RAW_HTML,
// translators: %s: URL to the Menus screen.
'raw' => sprintf(__('There are no menus in your site.
Go to the Menus screen to create one.', 'advanced-menu-builder-for-elementor'), admin_url('nav-menus.php?action=edit&menu=0')),
'separator' => 'after',
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
)
);
}
$this->add_control(
'layout',
array(
'label' => esc_html__('Layout', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'horizontal',
'options' => array(
'horizontal' => esc_html__('Horizontal', 'advanced-menu-builder-for-elementor'),
'vertical' => esc_html__('Vertical', 'advanced-menu-builder-for-elementor'),
// 'dropdown' => esc_html__('Dropdown', 'advanced-menu-builder-for-elementor'), // Hidden for future
),
'prefix_class' => 'nexus-menu-layout-',
)
);
$this->add_responsive_control(
'align_items',
array(
'label' => esc_html__('Alignment', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::CHOOSE,
'options' => array(
'left' => array(
'title' => esc_html__('Left', 'advanced-menu-builder-for-elementor'),
'icon' => 'eicon-text-align-left',
),
'center' => array(
'title' => esc_html__('Center', 'advanced-menu-builder-for-elementor'),
'icon' => 'eicon-text-align-center',
),
'right' => array(
'title' => esc_html__('Right', 'advanced-menu-builder-for-elementor'),
'icon' => 'eicon-text-align-right',
),
'justify' => array(
'title' => esc_html__('Stretch', 'advanced-menu-builder-for-elementor'),
'icon' => 'eicon-text-align-justify',
),
),
'prefix_class' => 'nexus-menu-align-%s',
'condition' => array(
'layout!' => 'dropdown',
),
)
);
$this->add_control(
'pointer',
array(
'label' => esc_html__('Pointer', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'none',
'options' => array(
'none' => esc_html__('None', 'advanced-menu-builder-for-elementor'),
'underline' => esc_html__('Underline', 'advanced-menu-builder-for-elementor'),
'overline' => esc_html__('Overline', 'advanced-menu-builder-for-elementor'),
'framed' => esc_html__('Framed', 'advanced-menu-builder-for-elementor'),
'background' => esc_html__('Background', 'advanced-menu-builder-for-elementor'),
),
'prefix_class' => 'nexus-menu-pointer-',
'condition' => array(
'layout!' => 'dropdown',
),
)
);
$this->add_control(
'submenu_icon',
array(
'label' => esc_html__('Submenu Indicator', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'arrow',
'options' => array(
'none' => esc_html__('None', 'advanced-menu-builder-for-elementor'),
'arrow' => esc_html__('Classic Arrow', 'advanced-menu-builder-for-elementor'),
'plus' => esc_html__('Plus Sign', 'advanced-menu-builder-for-elementor'),
'chevron' => esc_html__('Chevron', 'advanced-menu-builder-for-elementor'),
),
'prefix_class' => 'nexus-submenu-icon-',
)
);
$this->add_control(
'heading_mobile_dropdown',
array(
'label' => esc_html__('Mobile Dropdown', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
'condition' => array(
'layout!' => 'dropdown',
),
)
);
$this->add_control(
'breakpoint',
array(
'label' => esc_html__('Breakpoint', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'mobile',
'options' => array(
'none' => esc_html__('None', 'advanced-menu-builder-for-elementor'),
'tablet' => esc_html__('Tablet (<= 1024px)', 'advanced-menu-builder-for-elementor'),
'mobile' => esc_html__('Mobile (< 768px)', 'advanced-menu-builder-for-elementor'),
),
'prefix_class' => 'nexus-menu-breakpoint-',
'condition' => array(
'layout!' => 'dropdown',
),
)
);
$menus = $this->get_available_menus();
if (!empty($menus)) {
$this->add_control(
'mobile_menu',
array(
'label' => esc_html__('Mobile Menu (Optional)', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => array('' => esc_html__('Default (Same as Desktop)', 'advanced-menu-builder-for-elementor')) + $menus,
'default' => '',
'description' => esc_html__('Select a different menu to display on mobile devices inside the hamburger menu.', 'advanced-menu-builder-for-elementor'),
'condition' => array(
'breakpoint!' => 'none',
),
'separator' => 'after',
)
);
}
$this->add_control(
'full_width',
array(
'label' => esc_html__('Full Width', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'description' => esc_html__('Stretch the dropdown of the menu to full width', 'advanced-menu-builder-for-elementor'),
'prefix_class' => 'nexus-menu-mobile-full-width-',
'condition' => array(
// 'layout!' => 'dropdown', // Allow for dropdown layout
),
)
);
$this->add_control(
'toggle',
array(
'label' => esc_html__('Toggle Button', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'burger',
'options' => array(
'none' => esc_html__('None', 'advanced-menu-builder-for-elementor'),
'burger' => esc_html__('Hamburger', 'advanced-menu-builder-for-elementor'),
),
'condition' => array(
// 'layout!' => 'dropdown', // Allow for dropdown to configure or usage defaults. But practically, if layout=dropdown, toggle is ALWAYS burger.
// Actually, if layout=dropdown, we should likely Hide the "None" option or force it.
// But for simplicity, let's just show it.
),
)
);
$this->add_control(
'toggle_icon',
array(
'label' => esc_html__('Icon', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::ICONS,
'default' => array(
'value' => 'fas fa-bars',
'library' => 'fa-solid',
),
'condition' => array(
'toggle!' => 'none',
// 'toggle' => 'burger', // Match the select value - removed strict check to allow if we force it in render
),
)
);
$this->add_responsive_control(
'toggle_align',
array(
'label' => esc_html__('Toggle Align', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::CHOOSE,
'options' => array(
'left' => array('title' => esc_html__('Left', 'advanced-menu-builder-for-elementor'), 'icon' => 'eicon-h-align-left'),
'center' => array('title' => esc_html__('Center', 'advanced-menu-builder-for-elementor'), 'icon' => 'eicon-h-align-center'),
'right' => array('title' => esc_html__('Right', 'advanced-menu-builder-for-elementor'), 'icon' => 'eicon-h-align-right'),
),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle-wrapper' => 'text-align: {{VALUE}};',
),
'condition' => array(
'toggle!' => 'none',
),
)
);
$this->end_controls_section();
// --- STYLE: MAIN MENU ---
$this->start_controls_section(
'section_style_main_menu',
array(
'label' => esc_html__('Main Menu', 'advanced-menu-builder-for-elementor'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
)
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
array(
'name' => 'menu_typography',
'selector' => '{{WRAPPER}} .nexus-menu-main > li > a',
)
);
$this->add_responsive_control(
'menu_icon_size',
array(
'label' => esc_html__('Icon Size', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('min' => 0, 'max' => 100)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-icon' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .nexus-menu-icon-img' => 'width: {{SIZE}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'pointer_width',
array(
'label' => esc_html__('Pointer Width', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('max' => 50)),
'selectors' => array(
'{{WRAPPER}}.nexus-menu-pointer-underline .nexus-menu-main > li > a:before' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.nexus-menu-pointer-overline .nexus-menu-main > li > a:before' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.nexus-menu-pointer-framed .nexus-menu-main > li > a' => 'border-width: {{SIZE}}{{UNIT}};',
),
'condition' => array(
'pointer!' => ['none', 'background'],
),
)
);
$this->start_controls_tabs('tabs_menu_item_style');
// Normal Tab
$this->start_controls_tab(
'tab_menu_item_normal',
array('label' => esc_html__('Normal', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_menu_item',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a' => 'color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
// Hover Tab
$this->start_controls_tab(
'tab_menu_item_hover',
array('label' => esc_html__('Hover', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_menu_item_hover',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a:hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-main > li > a:hover .nexus-menu-icon' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-main > li > a:hover svg' => 'fill: {{VALUE}}',
),
)
);
$this->add_control(
'pointer_color_hover',
array(
'label' => esc_html__('Pointer Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}}.nexus-menu-pointer-underline .nexus-menu-main > li > a:before' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-menu-pointer-overline .nexus-menu-main > li > a:before' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-menu-pointer-framed .nexus-menu-main > li > a:hover' => 'border-color: {{VALUE}}',
),
'condition' => array(
'pointer!' => ['none', 'background'],
),
)
);
$this->add_control(
'background_color_menu_item_hover',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a:hover' => 'background-color: {{VALUE}}',
),
'condition' => array(
'pointer' => 'background',
),
)
);
$this->end_controls_tab();
// Active Tab
$this->start_controls_tab(
'tab_menu_item_active',
array('label' => esc_html__('Active', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_menu_item_active',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li.current-menu-item > a' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-main > li.current-menu-item > a .nexus-menu-icon' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-main > li.current-menu-item > a svg' => 'fill: {{VALUE}}',
),
)
);
$this->add_control(
'pointer_color_active',
array(
'label' => esc_html__('Pointer Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}}.nexus-menu-pointer-underline .nexus-menu-main > li.current-menu-item > a:before' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-menu-pointer-overline .nexus-menu-main > li.current-menu-item > a:before' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-menu-pointer-framed .nexus-menu-main > li.current-menu-item > a' => 'border-color: {{VALUE}}',
),
'condition' => array(
'pointer!' => ['none', 'background'],
),
)
);
$this->add_control(
'background_color_menu_item_active',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li.current-menu-item > a' => 'background-color: {{VALUE}}',
),
'condition' => array(
'pointer' => 'background',
),
)
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'menu_item_border_radius',
array(
'label' => esc_html__('Border Radius', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => array('px', '%'),
'default' => array(
'top' => 12,
'right' => 12,
'bottom' => 0,
'left' => 0,
'unit' => 'px',
'isLinked' => false,
),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
array(
'name' => 'menu_item_box_shadow',
'selector' => '{{WRAPPER}} .nexus-menu-main > li > a',
)
);
$this->add_control(
'divider',
array(
'label' => esc_html__('Divider', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'separator' => 'before',
'prefix_class' => 'nexus-menu-divider-', // This adds nexus-menu-divider-yes class automatically!
'condition' => array(
'layout!' => 'dropdown',
),
)
);
$this->add_control(
'divider_style',
array(
'label' => esc_html__('Style', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'solid',
'options' => array(
'solid' => esc_html__('Solid', 'advanced-menu-builder-for-elementor'),
'dotted' => esc_html__('Dotted', 'advanced-menu-builder-for-elementor'),
'dashed' => esc_html__('Dashed', 'advanced-menu-builder-for-elementor'),
'custom' => esc_html__('Custom Icon', 'advanced-menu-builder-for-elementor'),
),
'condition' => array(
'divider' => 'yes',
),
)
);
$this->add_control(
'divider_custom_icon',
array(
'label' => esc_html__('Icon', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::MEDIA,
'condition' => array(
'divider' => 'yes',
'divider_style' => 'custom',
),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li:not(:last-child):after' => 'background-image: url("{{URL}}"); border: none;',
),
)
);
$this->add_responsive_control(
'divider_width',
array(
'label' => esc_html__('Width', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => array('px', '%'),
'range' => array('px' => array('max' => 50)),
'default' => array('unit' => 'px', 'size' => 1),
'condition' => array(
'divider' => 'yes',
),
'selectors' => array(
// Horizontal Layout: Width is thickness (border-right-width) OR Image Width
'{{WRAPPER}}.nexus-menu-layout-horizontal .nexus-menu-main > li:not(:last-child):after' => 'width: {{SIZE}}{{UNIT}}; border-right-width: {{SIZE}}{{UNIT}};',
// Vertical Layout: Width is Length
'{{WRAPPER}}.nexus-menu-layout-vertical .nexus-menu-main > li:not(:last-child):after' => 'width: {{SIZE}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'divider_height',
array(
'label' => esc_html__('Height', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => array('px', '%'),
'range' => array('px' => array('max' => 100)),
'default' => array('unit' => 'px', 'size' => 20),
'condition' => array(
'divider' => 'yes',
),
'selectors' => array(
// Horizontal Layout: Height is Length
'{{WRAPPER}}.nexus-menu-layout-horizontal .nexus-menu-main > li:not(:last-child):after' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.nexus-menu-layout-horizontal .nexus-menu-main > li > a' => 'min-height: {{SIZE}}{{UNIT}};',
// Vertical Layout: Height is Thickness (border-bottom-width) OR Image Height
'{{WRAPPER}}.nexus-menu-layout-vertical .nexus-menu-main > li:not(:last-child):after' => 'height: {{SIZE}}{{UNIT}}; border-bottom-width: {{SIZE}}{{UNIT}};',
),
)
);
$this->add_control(
'divider_color',
array(
'label' => esc_html__('Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#ddd',
'condition' => array(
'divider' => 'yes',
'divider_style!' => 'custom',
),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li:not(:last-child):after' => 'border-color: {{VALUE}};',
),
)
);
// Apply Styles based on selection
$this->add_control(
'divider_style_applier',
array(
'type' => \Elementor\Controls_Manager::HIDDEN,
'default' => 'solid',
'selectors' => array(
// Horizontal Rule
'{{WRAPPER}}.nexus-menu-layout-horizontal .nexus-menu-main > li:not(:last-child):after' => 'border-right-style: {{divider_style.VALUE}};',
// Vertical Rule
'{{WRAPPER}}.nexus-menu-layout-vertical .nexus-menu-main > li:not(:last-child):after' => 'border-bottom-style: {{divider_style.VALUE}};',
),
'condition' => array(
'divider' => 'yes',
'divider_style!' => 'custom',
),
)
);
$this->add_responsive_control(
'padding_horizontal_menu_item',
array(
'label' => esc_html__('Horizontal Padding', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('max' => 50)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}',
),
)
);
$this->add_responsive_control(
'padding_vertical_menu_item',
array(
'label' => esc_html__('Vertical Padding', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('max' => 50)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li > a' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}',
),
)
);
$this->add_responsive_control(
'space_between',
array(
'label' => esc_html__('Space Between', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('max' => 100)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main > li' => '--nexus-menu-space-between: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .nexus-menu-main > li:last-child' => 'margin-right: 0',
),
)
);
$this->end_controls_section();
// --- STYLE: DROPDOWN ---
$this->start_controls_section(
'section_style_dropdown',
array(
'label' => esc_html__('Dropdown', 'advanced-menu-builder-for-elementor'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
)
);
$this->add_control(
'dropdown_description',
array(
'type' => \Elementor\Controls_Manager::RAW_HTML,
'raw' => esc_html__('On desktop, this will affect the submenu. On mobile, this will affect the entire menu.', 'advanced-menu-builder-for-elementor'),
'content_classes' => 'elementor-descriptor',
'separator' => 'after', // Add some space after
)
);
$this->add_control(
'dropdown_background_color',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu' => 'background-color: {{VALUE}};',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main' => 'background-color: {{VALUE}};',
),
)
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
array(
'name' => 'dropdown_typography',
'selector' => '{{WRAPPER}} .nexus-menu-main .sub-menu li a, {{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a',
)
);
$this->start_controls_tabs('tabs_dropdown_item_style');
// Dropdown Normal
$this->start_controls_tab(
'tab_dropdown_item_normal',
array('label' => esc_html__('Normal', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_dropdown_item',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li a' => 'color: {{VALUE}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a' => 'color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->end_controls_tab();
// Dropdown Hover
$this->start_controls_tab(
'tab_dropdown_item_hover',
array('label' => esc_html__('Hover', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_dropdown_item_hover',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li a:hover' => 'color: {{VALUE}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a:hover' => 'color: {{VALUE}}',
),
)
);
$this->add_control(
'background_color_dropdown_item_hover',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li a:hover' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a:hover' => 'background-color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
// Dropdown Active
$this->start_controls_tab(
'tab_dropdown_item_active',
array('label' => esc_html__('Active', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'color_dropdown_item_active',
array(
'label' => esc_html__('Text Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li.current-menu-item a' => 'color: {{VALUE}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li.current-menu-item > a' => 'color: {{VALUE}}',
),
)
);
$this->add_control(
'background_color_dropdown_item_active',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li.current-menu-item a' => 'background-color: {{VALUE}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li.current-menu-item > a' => 'background-color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
array(
'name' => 'dropdown_border',
'selector' => '{{WRAPPER}} .nexus-menu-main .sub-menu, {{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main',
'separator' => 'before',
)
);
$this->add_responsive_control(
'dropdown_border_radius',
array(
'label' => esc_html__('Border Radius', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => array('px', '%'),
'default' => array(
'top' => 12,
'right' => 12,
'bottom' => 12,
'left' => 12,
'unit' => 'px',
'isLinked' => true,
),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .nexus-mega-menu-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
array(
'name' => 'dropdown_box_shadow',
// phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
'exclude' => array(
'box_shadow_position',
),
'selector' => '{{WRAPPER}} .nexus-menu-main .sub-menu',
)
);
$this->add_responsive_control(
'padding_horizontal_dropdown_item',
array(
'label' => esc_html__('Horizontal Padding', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li a' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}',
),
'separator' => 'before',
)
);
$this->add_responsive_control(
'padding_vertical_dropdown_item',
array(
'label' => esc_html__('Vertical Padding', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu li a' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main > li > a' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}',
),
)
);
$this->add_responsive_control(
'dropdown_distance',
array(
'label' => esc_html__('Dropdown Distance from Top', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('max' => 100)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-main .sub-menu' => 'margin-top: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .nexus-mega-menu-container' => 'margin-top: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.nexus-layout-mobile-active .nexus-menu-main' => 'margin-top: {{SIZE}}{{UNIT}}',
),
)
);
$this->end_controls_section();
// --- STYLE: TOGGLE BUTTON ---
$this->start_controls_section(
'section_style_toggle',
array(
'label' => esc_html__('Toggle Button', 'advanced-menu-builder-for-elementor'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
'condition' => array(
'toggle!' => 'none',
),
)
);
$this->start_controls_tabs('tabs_toggle_style');
$this->start_controls_tab(
'tab_toggle_normal',
array('label' => esc_html__('Normal', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'toggle_color',
array(
'label' => esc_html__('Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle i' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle svg path' => 'fill: {{VALUE}}',
),
)
);
$this->add_control(
'toggle_background_color',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'background-color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_toggle_hover',
array('label' => esc_html__('Hover', 'advanced-menu-builder-for-elementor'))
);
$this->add_control(
'toggle_color_hover',
array(
'label' => esc_html__('Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle:hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle:hover i' => 'color: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle:hover svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .nexus-menu-toggle:hover svg path' => 'fill: {{VALUE}}',
),
)
);
$this->add_control(
'toggle_background_color_hover',
array(
'label' => esc_html__('Background Color', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle:hover' => 'background-color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'toggle_size',
array(
'label' => esc_html__('Size', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::SLIDER,
'range' => array('px' => array('min' => 0, 'max' => 100)),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'font-size: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .nexus-menu-toggle i' => 'font-size: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .nexus-menu-toggle svg' => 'width: {{SIZE}}{{UNIT}}; height: auto;',
),
)
);
$this->add_responsive_control(
'toggle_border_width',
array(
'label' => esc_html__('Border Width', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => array('px'),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; border-style: solid;',
),
)
);
$this->add_responsive_control(
'toggle_border_radius',
array(
'label' => esc_html__('Border Radius', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => array('px', '%'),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'toggle_padding',
array(
'label' => esc_html__('Padding', 'advanced-menu-builder-for-elementor'),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => array('px', 'em', '%'),
'selectors' => array(
'{{WRAPPER}} .nexus-menu-toggle' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->end_controls_section();
}
protected function render()
{
$settings = $this->get_settings_for_display();
$menu_id = $settings['menu'];
if (!$menu_id) {
return;
}
if (!class_exists('Nexus_Menu_Frontend_Walker')) {
require_once NEXUS_MENU_PLUGIN_DIR . 'includes/public/class-nexus-menu-frontend-walker.php';
}
// Add container classes based on settings
$container_classes = 'nexus-menu-wrapper';
if (isset($settings['layout'])) {
$container_classes .= ' nexus-menu-' . $settings['layout'];
}
echo '