', 'aihub-core' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'magnetic_items',
[
'label' => esc_html__( 'Magnetic top level links?', 'aihub-core' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
]
);
$this->add_control(
'lqd_adaptive_color',
[
'label' => esc_html__( 'Enable adaptive color?', 'aihub-core' ),
'description' => esc_html__( 'Useful for elements with fixed css position or when inside sticky header. This option make the element chage color dynamically when it is over light or dark sections.', 'aihub-core' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before'
]
);
$this->end_controls_section();
\LQD_Elementor_Helper::add_style_controls(
$this,
'menu',
[
'ul_top' => [
'label' => 'Navigation',
'controls' => [
[
'type' => 'gap',
'label' => 'Gap between links',
'css_var' => '--lqd-menu-ul-gap'
],
[
'type' => 'width',
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'width: {{SIZE}}{{UNIT}};min-width: {{SIZE}}{{UNIT}};'
],
'condition' => [
'layout' => 'dropdown'
]
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_position_h',
[
'label' => esc_html__( 'Horizontal orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'start' => [
'title' => esc_html__( 'Start', 'aihub-core' ),
'icon' => 'eicon-h-align-left',
],
'end' => [
'title' => esc_html__( 'End', 'aihub-core' ),
'icon' => 'eicon-h-align-right',
],
],
'toggle' => false,
'default' => 'start',
'condition' => [
'layout' => 'dropdown',
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_offset_x',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw' ],
'default' => [
'unit' => '%',
'size' => '0'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'inset-inline-start: {{SIZE}}{{UNIT}}',
],
'condition' => [
'layout' => 'dropdown',
'ul_top_position_h' => 'start'
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_offset_x_end',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw' ],
'default' => [
'unit' => '%',
'size' => '0'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'inset-inline-start: auto; inset-inline-end: {{SIZE}}{{UNIT}}',
],
'condition' => [
'layout' => 'dropdown',
'ul_top_position_h' => 'end'
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_position_v',
[
'label' => esc_html__( 'Vertical orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'aihub-core' ),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'aihub-core' ),
'icon' => 'eicon-v-align-bottom',
],
],
'toggle' => false,
'default' => 'top',
'condition' => [
'layout' => 'dropdown',
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_offset_y',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh' ],
'default' => [
'unit' => '%',
'size' => '100'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'top: {{SIZE}}{{UNIT}}',
],
'condition' => [
'layout' => 'dropdown',
'ul_top_position_v' => 'top'
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'raw',
'raw_options' => [
'ul_top_offset_y_bottom',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh' ],
'default' => [
'unit' => '%',
'size' => '100'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'top: auto; bottom: {{SIZE}}{{UNIT}}',
],
'condition' => [
'layout' => 'dropdown',
'ul_top_position_v' => 'bottom'
]
]
],
'responsive' => true,
'tab' => 'none'
],
[
'type' => 'margin',
'css_var' => '--lqd-menu-ul-m'
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-ul-p'
],
[
'type' => 'css_backdrop_filter',
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-ul-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-ul-br'
],
[
'type' => 'border_radius',
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-ul-bs'
],
],
'plural_heading' => false,
'state_tabs' => [ 'normal', 'hover' ]
],
'li_top' => [
'label' => 'Menu item',
'controls' => [
[
'type' => 'typography',
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-link-p'
],
[
'type' => 'liquid_color',
'css_var' => '--lqd-menu-link-color'
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-link-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-link-br'
],
[
'type' => 'border_radius',
'css_var' => '--lqd-menu-link-brr'
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-link-bs'
],
[
'type' => 'opacity',
'css_var' => '--lqd-menu-link-op'
],
],
'state_tabs' => [ 'normal', 'hover', 'active' ],
'state_selectors' => [ 'active' => ' :is(.lqd-menu-link-top.lqd-is-active, .lqd-menu-li-top.current-menu-item > a)' ]
],
'dropdown' => [
'label' => 'Submenu',
'controls' => [
[
'type' => 'gap',
'label' => 'Gap between links'
],
[
'type' => 'width',
'selectors' => [
'{{WRAPPER}} .lqd-menu-dropdown' => 'width: {{SIZE}}{{UNIT}};min-width: {{SIZE}}{{UNIT}};'
]
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-dropdown-p'
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_position_h',
[
'label' => esc_html__( 'Horizontal orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'start' => [
'title' => esc_html__( 'Start', 'aihub-core' ),
'icon' => 'eicon-h-align-left',
],
'end' => [
'title' => esc_html__( 'End', 'aihub-core' ),
'icon' => 'eicon-h-align-right',
],
],
'toggle' => false,
'default' => 'start',
'selectors_dictionary' => [
'start' => 'inset-inline-end: auto;',
'end' => 'inset-inline-start: auto;',
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => '{{VALUE}}'
]
]
],
'responsive' => true
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_offset_x',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw' ],
'default' => [
'unit' => '%',
'size' => '0'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => 'inset-inline-start: {{SIZE}}{{UNIT}}',
],
'condition' => [
'dropdown_position_h' => 'start'
],
]
],
'responsive' => true
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_offset_x_end',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw' ],
'default' => [
'unit' => '%',
'size' => '0'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => 'inset-inline-start: auto; inset-inline-end: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .lqd-menu-li-top .lqd-menu-dropdown .lqd-menu-dropdown' => 'inset-inline-start: auto; inset-inline-end: 100%',
],
'condition' => [
'dropdown_position_h' => 'end'
],
]
],
'responsive' => true
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_position_v',
[
'label' => esc_html__( 'Vertical orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'aihub-core' ),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'aihub-core' ),
'icon' => 'eicon-v-align-bottom',
],
],
'toggle' => false,
'default' => 'top',
'selectors_dictionary' => [
'top' => 'bottom: auto;',
'bottom' => 'top: auto;',
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => '{{VALUE}}'
]
]
],
'responsive' => true
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_offset_y',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh' ],
'default' => [
'unit' => '%',
'size' => '100'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => 'top: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .lqd-menu-dropdown-trigger:after' => 'bottom: calc({{SIZE}}{{UNIT}} * -1)',
],
'condition' => [
'dropdown_position_v' => 'top'
],
]
],
'responsive' => true
],
[
'type' => 'raw',
'raw_options' => [
'dropdown_offset_y_bottom',
[
'label' => esc_html__( 'Offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh' ],
'default' => [
'unit' => '%',
'size' => '100'
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-li-top > .lqd-menu-dropdown' => 'top: auto; bottom: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .lqd-menu-dropdown-trigger:after' => 'bottom: 100%; top: calc({{SIZE}}{{UNIT}} * -1)',
'{{WRAPPER}} .lqd-menu-li-top .lqd-menu-dropdown .lqd-menu-dropdown' => 'top: auto; bottom: 0',
],
'condition' => [
'dropdown_position_v' => 'bottom'
],
]
],
'responsive' => true
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-dropdown-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-dropdown-br'
],
[
'type' => 'border_radius',
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-dropdown-bs'
],
],
],
'dropdown_link' => [
'label' => 'Submenu item',
'controls' => [
[
'type' => 'typography',
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-dropdown-link-p'
],
[
'type' => 'liquid_color',
'css_var' => '--lqd-menu-dropdown-link-color'
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-dropdown-link-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-dropdown-link-br'
],
[
'type' => 'border_radius',
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-dropdown-link-bs'
],
],
'state_tabs' => [ 'normal', 'hover' ],
],
'icon' => [
'controls' => [
[
'type' => 'liquid_linked_dimensions',
],
[
'type' => 'font_size',
],
[
'type' => 'margin',
'css_var' => '--lqd-menu-icon-m'
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-icon-p'
],
[
'type' => 'liquid_color',
'css_var' => '--lqd-menu-icon-color'
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-icon-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-icon-br'
],
[
'type' => 'border_radius',
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-icon-bs'
],
],
'state_tabs' => [ 'normal', 'hover', 'active' ],
'state_selectors_before' => [ 'hover' => '.lqd-menu-link', 'active' => '.lqd-menu-link' ]
],
'badge' => [
'controls' => [
[
'type' => 'typography',
],
[
'type' => 'margin',
'css_var' => '--lqd-menu-badge-m'
],
[
'type' => 'padding',
'css_var' => '--lqd-menu-badge-p'
],
[
'type' => 'liquid_color',
'css_var' => '--lqd-menu-badge-color'
],
[
'type' => 'liquid_background_css',
'css_var' => '--lqd-menu-badge-bg'
],
[
'type' => 'border',
'css_var' => '--lqd-menu-badge-br'
],
[
'type' => 'border_radius',
'css_var' => '--lqd-menu-badge-brr'
],
[
'type' => 'box_shadow',
'css_var' => '--lqd-menu-badge-bs'
],
],
'state_tabs' => [ 'normal', 'hover', 'active' ],
'state_selectors_before' => [ 'hover' => '.lqd-menu-link', 'active' => '.lqd-menu-link' ]
],
],
);
$this->start_controls_section(
'mobile_dropdown_styles_section',
[
'label' => esc_html__( 'Mobile dropdown', 'aihub-core' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'mobile_dropdown' => 'yes'
]
]
);
foreach ( $breakpoints as $breakpoint_key => $breakpoint_instance ) {
$this->add_responsive_control(
'mobile_dropdown_width_' . $breakpoint_key,
[
'label' => esc_html__( 'Width', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw', 'custom' ],
'range' => [
'px' => [
'min' => -500,
'max' => 500,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
'step' => 1
],
'vw' => [
'min' => -100,
'max' => 100,
'step' => 1
],
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'width: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .lqd-menu-ul' => 'width: 100%',
],
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => ''
]
]
);
$this->add_control(
'mobile_dropdown_orientation_h_' . $breakpoint_key,
[
'label' => esc_html__( 'Horizontal orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'start' => [
'title' => esc_html__( 'Start', 'aihub-core' ),
'icon' => 'eicon-h-align-left',
],
'end' => [
'title' => esc_html__( 'End', 'aihub-core' ),
'icon' => 'eicon-h-align-right',
],
],
'toggle' => false,
'default' => 'start',
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => ''
]
]
);
$this->add_responsive_control(
'mobile_dropdown_offset_x_' . $breakpoint_key,
[
'label' => esc_html__( 'Horizontal offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw', 'custom' ],
'range' => [
'px' => [
'min' => -500,
'max' => 500,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
'step' => 1
],
'vw' => [
'min' => -100,
'max' => 100,
'step' => 1
],
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'inset-inline-start: {{SIZE}}{{UNIT}};inset-inline-end:auto!important;',
],
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => '',
'mobile_dropdown_orientation_h_'. $breakpoint_key => 'start'
]
]
);
$this->add_responsive_control(
'mobile_dropdown_offset_x_end_' . $breakpoint_key,
[
'label' => esc_html__( 'Horizontal offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vw', 'custom' ],
'range' => [
'px' => [
'min' => -500,
'max' => 500,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
'step' => 1
],
'vw' => [
'min' => -100,
'max' => 100,
'step' => 1
],
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'inset-inline-end: {{SIZE}}{{UNIT}};inset-inline-start:auto!important;',
],
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => '',
'mobile_dropdown_orientation_h_' . $breakpoint_key => 'end'
]
]
);
$this->add_control(
'mobile_dropdown_orientation_v_' . $breakpoint_key,
[
'label' => esc_html__( 'Vertical orientation', 'aihub-core' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'aihub-core' ),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'aihub-core' ),
'icon' => 'eicon-v-align-bottom',
],
],
'toggle' => false,
'default' => 'top',
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => ''
]
]
);
$this->add_responsive_control(
'mobile_dropdown_offset_y_' . $breakpoint_key,
[
'label' => esc_html__( 'Vertical offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh', 'custom' ],
'range' => [
'px' => [
'min' => -500,
'max' => 500,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
'step' => 1
],
'vh' => [
'min' => -100,
'max' => 100,
'step' => 1
],
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'top: {{SIZE}}{{UNIT}};bottom:auto !important;',
],
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => '',
'mobile_dropdown_orientation_v_' . $breakpoint_key => 'top',
]
]
);
$this->add_responsive_control(
'mobile_dropdown_offset_y_bottom' . $breakpoint_key,
[
'label' => esc_html__( 'Vertical offset', 'aihub-core' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'vh', 'custom' ],
'range' => [
'px' => [
'min' => -500,
'max' => 500,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
'step' => 1
],
'vh' => [
'min' => -100,
'max' => 100,
'step' => 1
],
],
'selectors' => [
'{{WRAPPER}} .lqd-menu-wrap' => 'bottom: {{SIZE}}{{UNIT}};top:auto !important;',
],
'condition' => [
'mobile_dropdown' => 'yes',
'mobile_dropdown_breakpoint_' . $breakpoint_key . '!' => '',
'mobile_dropdown_orientation_v_' . $breakpoint_key => 'bottom',
]
]
);
}
$this->add_responsive_control(
'mobile_dropdown_padding' . $breakpoint_key,
[
'label' => esc_html__( 'Padding', 'aihub-core' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .lqd-menu-ul-top' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
'liquid-background-css',
[
'name' => 'mobile_dropdown_background' . $breakpoint_key,
'types' => [ 'color', 'particles', 'animated-gradient' ],
'selector' => '(' . $breakpoint_key . '){{WRAPPER}} .lqd-menu-ul-top',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'mobile_dropdown_border' . $breakpoint_key,
'selector' => '{{WRAPPER}} .lqd-menu-ul-top',
'fields_options' => [
'color' => [
'type' => 'liquid-color',
'types' => [ 'solid' ],
],
]
]
);
$this->add_responsive_control(
'mobile_dropdown_border_radius' . $breakpoint_key,
[
'label' => esc_html__( 'Border radius', 'aihub-core' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .lqd-menu-ul-top' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'mobile_dropdown_box_shadow' . $breakpoint_key,
'selector' => '(' . $breakpoint_key . '){{WRAPPER}} .lqd-menu-ul-top',
]
);
$this->start_controls_tabs(
'mobile_dropdown_styles_tabs_' . $breakpoint_key,
);
$this->start_controls_tab(
'mobile_dropdown_styles_tab_' . $breakpoint_key . '_normal',
[
'label' => esc_html__( 'Normal', 'aihub-core' ),
]
);
$this->add_control(
'mobile_dropdown_color' . $breakpoint_key,
[
'label' => __( 'Color', 'aihub-core' ),
'type' => 'liquid-color',
'types' => [ 'solid' ],
'selectors' => [
'(' . $breakpoint_key . '){{WRAPPER}} .lqd-menu-ul-top' => '--lqd-menu-link-color: {{VALUE}}'
]
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'mobile_dropdown_styles_tab_' . $breakpoint_key . '_hover',
[
'label' => esc_html__( 'Hover', 'aihub-core' ),
]
);
$this->add_control(
'mobile_dropdown_color' . $breakpoint_key . '_hover',
[
'label' => __( 'Color', 'aihub-core' ),
'type' => 'liquid-color',
'types' => [ 'solid' ],
'selectors' => [
'(' . $breakpoint_key . '){{WRAPPER}} .lqd-menu-li-top .lqd-menu-link-top:hover' => '--lqd-menu-link-color: {{VALUE}}'
]
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'mobile_dropdown_styles_tab_' . $breakpoint_key . '_active',
[
'label' => esc_html__( 'Active', 'aihub-core' ),
]
);
$this->add_control(
'mobile_dropdown_color' . $breakpoint_key . '_active',
[
'label' => __( 'Color', 'aihub-core' ),
'type' => 'liquid-color',
'types' => [ 'solid' ],
'selectors' => [
'(' . $breakpoint_key . '){{WRAPPER}} .lqd-menu-li-top :is(.lqd-menu-link-top.lqd-is-active, .lqd-menu-li-top.current-menu-item > a)' => '--lqd-menu-link-color: {{VALUE}}'
]
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
$this->start_controls_section(
'individual_items_styles_section',
[
'label' => esc_html__( 'Individual items', 'aihub-core' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$individual_selectors = [
'first' => __( 'First item', 'aihub-core' ),
'last' => __( 'Last item', 'aihub-core' ),
'odd' => __( 'Odd items', 'aihub-core' ),
'even' => __( 'Even items', 'aihub-core' ),
];
$individual_item_styles = new Repeater();
$individual_item_styles->add_control(
'individual_selector', [
'label' => __( 'Selector', 'aihub-core' ),
'type' => Controls_Manager::SELECT,
'options' => $individual_selectors,
'default' => 'first',
'label_block' => true,
]
);
foreach ($individual_selectors as $individual_selector => $label) {
$this->add_nav_items_controls( $individual_item_styles, $individual_selector );
}
$this->add_control(
'individual_item_styles',
[
'label' => __( 'Individual items styling', 'aihub-core' ),
'type' => Controls_Manager::REPEATER,
'fields' => $individual_item_styles->get_controls(),
'title_field' => '{{{ individual_selector.replace( individual_selector.charAt(0), individual_selector.charAt(0).toUpperCase() ) }}}',
'prevent_empty' => false,
]
);
$this->end_controls_section();
// @see : https://developers.elementor.com/docs/editor-controls/conditional-display/#more-operators
$conditions = [
'relation' => 'or',
'terms' => [
[
'name' => 'layout',
'operator' => '===',
'value' => 'dropdown',
],
[
'name' => 'mobile_dropdown',
'operator' => '===',
'value' => 'yes',
],
],
];
\LQD_Elementor_Trigger::register_controls( $this, '', $conditions );
}
protected function add_render_attributes() {
parent::add_render_attributes();
$settings = $this->get_settings_for_display();
$this->add_render_attribute('_wrapper', [
'class' => [ 'lqd-widget-container-flex', 'lqd-widget-container-items-center' ],
'data-lqd-menu-dropdown-position-applied' => 'false'
]);
}
public function before_render() {
?>
get_settings_for_display();
$mobile_dropdown_is_active = false;
if ( $settings['layout'] !== 'dropdown' && $settings['mobile_dropdown'] === 'yes' ) {
$active_breakpoints = \Elementor\Plugin::instance()->breakpoints->get_active_breakpoints();
foreach ( $active_breakpoints as $breakpoint_key => $breakpoint_instance ) {
$setting = $settings[ 'mobile_dropdown_breakpoint_' . $breakpoint_key ];
if ( $setting && !empty( $setting ) ) {
$mobile_dropdown_is_active = true;
break;
}
}
}
return $mobile_dropdown_is_active;
}
protected function get_item_icon( $item ) {
if ( !isset( $item['icon'] ) || ( isset( $item['icon']['value'] ) && empty( $item['icon']['value'] ) ) ) return;
$icon_alignment = $item['icon_alignment'];
$attrs_id = 'item-' . $item['_id'] . '-icon-attrs';
$icon_classnames = [ 'lqd-menu-icon', 'lqd-menu-icon-' . $icon_alignment , 'inline-flex', 'shrink-0', 'transition-all' ];
if ( $icon_alignment === 'start' ) {
$icon_classnames[] = '-order-1';
} else {
}
$this->add_render_attribute( $attrs_id, [
'class' => $icon_classnames,
] );
?>
print_render_attribute_string( $attrs_id ); ?>> 'true', 'class' => 'w-1em h-auto align-middle fill-current relative' ] );
?>
add_link_attributes( 'link_' . $item['_id'], $item['link'] );
?>
get_item_icon( $item );
}
}
protected function get_wrap_classnames( $settings ) {
// added grow classname in case if the widget size is set to grow and make the alignment option work
$classname = [ 'lqd-menu-wrap', '[&.lqd-is-active:flex]', 'grow' ];
if ( $settings['layout'] === 'dropdown' ) {
array_push(
$classname,
'hidden',
'absolute',
'top-full',
'start-0',
'z-10'
);
}
if ( $settings['items_orientation'] === 'column' ) {
array_push(
$classname,
'lqd-menu-dropdown-block'
);
}
return $classname;
}
protected function get_ul_classnames($settings) {
$ul_classnames = ['lqd-menu-ul', 'lqd-menu-ul-top', 'flex', 'items-center', 'grow', 'list-none', 'transition-colors'];
return $ul_classnames;
}
protected function render_wp_menu($settings) {
$menu_slug = $settings['menu_slug'];
$ul_classnames = $this->get_ul_classnames($settings);
if ( empty($menu_slug) ) return;
echo wp_nav_menu([
'echo' => false,
'menu' => $menu_slug,
'menu_class' => implode(' ', $ul_classnames),
'fallback_cb' => '__return_empty_string',
'container' => '',
'link_before' => '',
'add_a_class' => 'flex items-center',
'walker' => class_exists('Liquid_Menu_Walker') ? new \Liquid_Menu_Walker() : '',
]);
}
protected function render_custom_menu($settings) {
$ul_classnames = $this->get_ul_classnames($settings);
$menu_items = $settings['custom_menu'];
if ( empty( $menu_items ) ) return;
?>add_render_attribute( $attrs_id, [
'id' => 'menu-item-' . esc_attr( $item['_id'] ),
'class' => $item_classnames,
] );
?>
- print_render_attribute_string( $attrs_id ) ?>>
get_item_markup( $item ); ?>
get_settings_for_display();
$trigger_classnames = [];
$wrap_classnames = $this->get_wrap_classnames( $settings );
if ( $this->mobile_dropdown_is_active() ) {
$trigger_classnames[] = 'hidden';
}
$this->add_render_attribute('menu-wrap', [
'class' => $wrap_classnames
]);
\LQD_Elementor_Trigger::render( $this, '', [ 'class' => $trigger_classnames ] );
?>print_render_attribute_string( 'menu-wrap' ) ?>>render_custom_menu($settings);
} else {
$this->render_wp_menu($settings);
}
?>
widgets_manager->register(new LQD_Menu());