Current File : /home/bravrvjk/cepurhuye.rw/wp-content/plugins/bopea-function/block//main-menu.php
<?php
namespace bopeaElementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Typography;
use Elementor\Schemes\Color;
use Elementor\Schemes\Typography;
use Elementor\Utils;
use Elementor\Control_Media;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Background;
use Elementor\Repeater;
use Elementor\Icons_Manager;
defined('ABSPATH') || die();
class bopea_section_main_menu extends Widget_Base {
public function get_name() {
return 'bopea-main-menu';
}
public function get_title() {
return esc_html__( 'Main Menu', 'bopea-function' );
}
public function get_icon() {
return 'eicon-nav-menu jl-icons';
}
public function get_categories() {
return [ 'bopea-elements-head' ];
}
protected function register_controls() {
$this->start_controls_section(
'content_section',
[
'label' => esc_html__( 'Main Menu', 'bopea-function' ),
]
);
if ( ! empty( bopea_get_menus() ) ) {
$this->add_control(
'inline_menu_slug',
[
'label' => esc_html__( 'Menu', 'bopea-function' ),
'type' => Controls_Manager::SELECT,
'options' => bopea_get_menus(),
'default' => array_keys( bopea_get_menus() )[0],
'save_default' => true,
'separator' => 'after',
'description' => sprintf( __( 'Go to the <a href="%s" target="_blank">Menus Option</a> to manage your menus.', 'bopea-function' ), admin_url( 'nav-menus.php' ) ),
]
);
} else {
$this->add_control(
'inline_menu_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf( __( '<strong>There are no menus in your site.</strong><br>Go to the <a href="%s" target="_blank">Menus Option</a> to create one.', 'bopea-function' ), admin_url( 'nav-menus.php?action=edit&menu=0' ) ),
'separator' => 'after',
]
);
}
$this->end_controls_section();
$this->start_controls_section(
'menu_item_style_section',
[
'label' => esc_html__( 'Menu Item', 'bopea-function' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'jl_mh_type',
[
'label' =>esc_html__( 'Main menu hover style', 'bopea-function' ),
'type' => Controls_Manager::SELECT,
'default' => 'jl_mm_lb',
'options' => [
'jl_mm_lb' => esc_html__( 'Hover line back animation', 'bopea-function' ),
'jl_mm_c' => esc_html__( 'Hover text color', 'bopea-function' ),
'jl_mh_bg' => esc_html__( 'Hover background', 'bopea-function' ),
'jl_mm_lbt' => esc_html__( 'Hover line bottom', 'bopea-function' ),
'jl_mm_bgt' => esc_html__( 'Background Menu Items', 'bopea' )
],
]
);
$this->add_responsive_control(
'area_alignment',
[
'label' => esc_html__( 'Alignment', 'bopea-function' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'bopea-function' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'bopea-function' ),
'icon' => 'eicon-text-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'bopea-function' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}}' => '--jl-bm-align: {{VALUE}};',
]
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'menu_item_typography',
'label' => esc_html__( 'Typography', 'bopea-function' ),
'selector' => '{{WRAPPER}} .jl_main_menu > .menu-item > a',
]
);
$this->add_responsive_control(
'menu_main_height',
[
'label' => esc_html__( 'Height', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 500,
'step' => 1,
]
],
'default' => [
'unit' => 'px',
'size' => 90,
],
'selectors' => [
'{{WRAPPER}}' => '--jl-mbm-h: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_mmh_line',
[
'label' => esc_html__( 'Hover line height', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 500,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-menu-ac-height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'menu_item_space',
[
'label' => esc_html__( 'Space', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-spacing-menu: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'menu_lbl_radius',
[
'label' => esc_html__( 'Menu label border radius', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}} .jl_menu_lb' => 'border-radius: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'menu_lbb_radius',
[
'label' => esc_html__( 'Menu background border radius', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-menu-bbgr: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_control(
'line_run_color',
[
'label' => esc_html__( 'Line/ Hover background', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}}' => '--jl-ha-skin: {{VALUE}}',
]
]
);
$this->add_control(
'line_run_color_dark',
[
'label' => esc_html__( 'Line/Hover background dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-ha-skin: {{VALUE}}',
]
]
);
$this->add_control(
'menu_normal_color',
[
'label' => esc_html__( 'Color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}}' => '--jl-menu-color: {{VALUE}}',
],
]
);
$this->add_control(
'menu_normal_color_dark',
[
'label' => esc_html__( 'Color dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFF',
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-menu-color: {{VALUE}}',
],
]
);
$this->add_control(
'menu_hover_color',
[
'label' => esc_html__( 'Color hover', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}}' => '--jl-menu-hcolor: {{VALUE}}',
],
]
);
$this->add_control(
'menu_hover_color_dark',
[
'label' => esc_html__( 'Color hover dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFF',
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-menu-hcolor: {{VALUE}}',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'sub_menu_item',
[
'label' => esc_html__( 'Sub Menu Item', 'bopea-function' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'mega_menu_layout',
[
'label' =>esc_html__( 'Mega menu layout', 'bopea-function' ),
'type' => Controls_Manager::SELECT,
'default' => 'jl_mm_box',
'options' => [
'jl_mm_full' =>esc_html__( 'Full width', 'bopea-function' ),
'jl_mm_box' =>esc_html__( 'Boxed width', 'bopea-function' ),
],
]
);
$this->add_responsive_control(
'mega_menu_with',
[
'label' => esc_html__( 'Mega menu inner width', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 3000,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-main-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_sub_radius',
[
'label' => esc_html__( 'Sub menu border radius', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-m-radius: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_sub_space',
[
'label' => esc_html__( 'Mega menu post space', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-mega-psize: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_sub_gap',
[
'label' => esc_html__( 'Mega menu post gap', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-mega-gap: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'jl_sub_tumbs',
[
'label' => esc_html__( 'Mega menu post thumbnail space', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
'step' => 1,
]
],
'selectors' => [
'{{WRAPPER}}' => '--jl-mega-thumb-space: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'sub_menu_item_typography',
'label' => esc_html__( 'Typography', 'bopea-function' ),
'selector' => '{{WRAPPER}} .navigation_wrapper .jl_main_menu .sub-menu .menu-item a',
]
);
$this->add_control(
'jl_show_border_menu',
[
'label' => esc_html__( 'Sub menu border', 'bopea-function' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_responsive_control(
'sub_menu_border',
[
'label' => esc_html__( 'Sub menu items border', 'bopea-function' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 30,
'step' => 1,
]
],
'default' => [
'unit' => 'px',
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .navigation_wrapper .jl_main_menu .menu-item:not(.menupost) .sub-menu .menu-item' => 'border: {{SIZE}}{{UNIT}} solid var(--jl-sub-line-color); margin-bottom:-{{SIZE}}{{UNIT}};',
'{{WRAPPER}} .navigation_wrapper .sub-menu:not(.menupost) .menu-item > .sub-menu' => 'margin-top:-{{SIZE}}{{UNIT}} !important;',
'{{WRAPPER}} .navigation_wrapper .jl_main_menu .sub-menu:not(.menupost)' => 'padding: 0px !important; margin-left: 0px !important; margin-right: 0px !important;',
'{{WRAPPER}} .navigation_wrapper .jl_main_menu .sub-menu .sub-menu' => 'left: 100% !important;',
],
'condition' => [
'jl_show_border_menu' => 'yes'
]
]
);
$this->add_responsive_control(
'sub_menu_padding',
[
'label' => esc_html__( 'Sub menu padding', 'bopea-function' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px'],
'selectors' => [
'{{WRAPPER}} .navigation_wrapper .jl_main_menu > .menu-item:not(.menupost) .menu-item a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .navigation_wrapper .jl_main_menu ul .menu-item-has-children > a:after' => 'right: {{RIGHT}}{{UNIT}};'
],
'condition' => [
'jl_show_border_menu' => 'yes'
]
]
);
$this->add_control(
'sub_menu_bg_color',
[
'label' => esc_html__( 'Background color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-bg-color: {{VALUE}};',
]
]
);
$this->add_control(
'sub_menu_bg_color_dark',
[
'label' => esc_html__( 'Background color dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-sub-bg-color: {{VALUE}};',
]
]
);
$this->add_control(
'sub_menu_normal_color',
[
'label' => esc_html__( 'Color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-menu-color: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_normal_color_dark',
[
'label' => esc_html__( 'Color dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-sub-menu-color: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_h_bg',
[
'label' => esc_html__( 'Background hover', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-item-bg: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_h_bg_dark',
[
'label' => esc_html__( 'Background hover dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-sub-item-bg: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_hover_color',
[
'label' => esc_html__( 'Color hover', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-hcolor: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_hover_color_dark',
[
'label' => esc_html__( 'Color hover dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-sub-hcolor: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_div_color',
[
'label' => esc_html__( 'Line Color', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}' => '--jl-sub-line-color: {{VALUE}};',
],
]
);
$this->add_control(
'sub_menu_div_color_dark',
[
'label' => esc_html__( 'Line Color dark mode', 'bopea-function' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.options_dark_skin {{WRAPPER}}' => '--jl-sub-line-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
protected function render( ) {
include 'main-menu-setting.php';
}
}