PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.3
Easy Elements for Elementor – Addons & Website Templates v1.5.3
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / widgets / navigation-menu / navigation-menu.php

navigation-menu.php in Easy Elements for Elementor – Addons & Website Templates 1.5.3, at widgets/navigation-menu/navigation-menu.php

2,021 lines 56.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 use Elementor\Controls_Manager;
4 use Elementor\Utils;
5 use Elementor\Group_Control_Typography;
6 use Elementor\Group_Control_Border;
7 use Elementor\Group_Control_Box_Shadow;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 // Include the Menu_Walker class
14 require_once plugin_dir_path( __FILE__ ) . 'menu-walker.php';
15
16 /**
17 * Class Nav Menu.
18 */
19 class Easyel_Navigation_Menu_Widget extends \Elementor\Widget_Base {
20
21 protected $script_handles = [];
22 public function __construct( $data = [], $args = null ) {
23 parent::__construct( $data, $args );
24
25 $js_files = [
26 'widgets/navigation-menu/js/navigation-menu.min.js',
27 ];
28
29 foreach ( $js_files as $js ) {
30
31 $path = EASYELEMENTS_DIR_PATH . $js;
32
33 if ( file_exists( $path ) ) {
34
35 $handle = 'easyel-' . md5( $js );
36
37 wp_register_script(
38 $handle,
39 EASYELEMENTS_DIR_URL . $js,
40 [ 'jquery' ],
41 filemtime( $path ),
42 true
43 );
44
45 $this->script_handles[] = $handle;
46 }
47 }
48 }
49
50 /**
51 * Menu index.
52 *
53 * @access protected
54 * @var int $nav_menu_index
55 */
56 // phpcs:ignore
57 protected $nav_menu_index = 1;
58
59 /**
60 * Retrieve the widget name.
61 *
62 * @since 1.3.0
63 *
64 * @access public
65 *
66 * @return string Widget name.
67 */
68
69 public function get_name() {
70 return 'eel-navigation-menu';
71 }
72
73 /**
74 * Retrieve the widget title.
75 *
76 * @since 1.3.0
77 *
78 * @access public
79 *
80 * @return string Widget title.
81 */
82 public function get_title() {
83 return esc_html__( 'Nav Menu', 'easy-elements' );
84 }
85
86 /**
87 * Retrieve the widget icon.
88 *
89 * @since 1.3.0
90 *
91 * @access public
92 *
93 * @return string Widget icon.
94 */
95 public function get_icon() {
96 return 'easyicon easyelIcon-navigation';
97 }
98
99 /**
100 * Retrieve the widget categories.
101 *
102 * @since 1.3.0
103 *
104 * @access public
105 *
106 * @return array Widget categories.
107 */
108 public function get_categories() {
109 return [ 'easyelements_header_footer_category' ];
110 }
111
112 public function get_style_depends() {
113 return [
114 'eel-navigation-menu',
115 ];
116 }
117
118 public function get_script_depends() {
119 return $this->script_handles;
120 }
121
122 /**
123 * Retrieve the menu index.
124 *
125 * Used to get index of nav menu.
126 *
127 * @since 1.3.0
128 * @access protected
129 *
130 * @return int nav index.
131 */
132 protected function get_nav_menu_index() {
133 return $this->nav_menu_index++;
134 }
135
136 /**
137 * Retrieve the list of available menus.
138 *
139 * Used to get the list of available menus.
140 *
141 * @since 1.3.0
142 * @access private
143 *
144 * @return array get WordPress menus list.
145 */
146 private function get_available_menus() {
147
148 $menus = wp_get_nav_menus();
149
150 $options = [];
151
152 foreach ( $menus as $menu ) {
153 $options[ $menu->slug ] = $menu->name;
154 }
155
156 return $options;
157 }
158
159 /**
160 * Check if the Elementor is updated.
161 *
162 * @since 1.3.0
163 *
164 * @return boolean if Elementor updated.
165 */
166 public static function is_elementor_updated() {
167 if ( class_exists( 'Elementor\Icons_Manager' ) ) {
168 return true;
169 } else {
170 return false;
171 }
172 }
173
174
175 /**
176 * Register Nav Menu controls.
177 *
178 * @since 1.5.7
179 * @access protected
180 * @return void
181 */
182
183 public function get_keywords() {
184 return [ 'navigation', 'menu', 'nav', 'text' ];
185 }
186 protected function register_controls() {
187
188 $this->register_general_content_controls();
189 $this->register_style_content_controls();
190 $this->register_dropdown_content_controls();
191 }
192
193 /**
194 * Register Nav Menu General Controls.
195 *
196 * @since 1.3.0
197 * @access protected
198 * @return void
199 */
200
201 protected function register_general_content_controls() {
202
203 $this->start_controls_section(
204 'section_menu',
205 [
206 'label' => __( 'Menu Settings', 'easy-elements' ),
207 ]
208 );
209
210 $menus = $this->get_available_menus();
211
212 if ( ! empty( $menus ) ) {
213 $this->add_control(
214 'menu',
215 [
216 'label' => __( 'Menu', 'easy-elements' ),
217 'type' => Controls_Manager::SELECT,
218 'options' => $menus,
219 'default' => array_keys( $menus )[0],
220 'save_default' => true,
221 /* translators: %s Nav menu URL */
222 'description' => sprintf( __( 'Go to the <a href="%s" target="_blank">Menus screen</a> to manage your menus.', 'easy-elements' ), admin_url( 'nav-menus.php' ) ),
223 ]
224 );
225 } else {
226 $this->add_control(
227 'menu',
228 [
229 'type' => Controls_Manager::RAW_HTML,
230 /* translators: %s Nav menu URL */
231 'raw' => sprintf( __( '<strong>There are no menus in your site.</strong><br>Go to the <a href="%s" target="_blank">Menus screen</a> to create one.', 'easy-elements' ), admin_url( 'nav-menus.php?action=edit&menu=0' ) ),
232 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
233 ]
234 );
235 }
236
237 $this->add_control(
238 'enable_sticky_header',
239 [
240 'label' => __( 'Enable Sticky Header', 'easy-elements' ),
241 'type' => Controls_Manager::SWITCHER,
242 'label_on' => __( 'Yes', 'easy-elements' ),
243 'label_off' => __( 'No', 'easy-elements' ),
244 'frontend_available' => true,
245 'default' => 'no',
246 ]
247 );
248
249 $this->add_control(
250 'fixed_top_sticky',
251 [
252 'label' => __( 'Fixed Top Sticky', 'easy-elements' ),
253 'type' => Controls_Manager::SWITCHER,
254 'label_on' => __( 'Yes', 'easy-elements' ),
255 'label_off' => __( 'No', 'easy-elements' ),
256 'frontend_available' => true,
257 'default' => 'no',
258 'condition' => [
259 'enable_sticky_header' => 'yes',
260 ],
261 ]
262 );
263
264 $this->start_controls_tabs(
265 'sticky_bg_color_tabs',
266 [
267 'condition' => [
268 'enable_sticky_header' => 'yes',
269 ],
270 ]
271 );
272
273 $this->start_controls_tab(
274 'sticky_bg_color_normal_tab',
275 [
276 'label' => __( 'Normal', 'easy-elements' ),
277 'condition' => [
278 'enable_sticky_header' => 'yes',
279 ],
280 ]
281 );
282
283 $this->add_control(
284 'bg_color_sticky_normal',
285 [
286 'label' => __( 'Background Color', 'easy-elements' ),
287 'type' => Controls_Manager::COLOR,
288 'default' => '',
289 'description' => __( 'Note: If you are using the Sticky Header background color, Do not set a background color from the Elementor container or section. Please use the Sticky option to set the normal background color to avoid conflicts.', 'easy-elements' ),
290 'selectors' => [
291 'header.eel-sticky-header-on' => 'background-color: {{VALUE}}',
292 ],
293 'condition' => [
294 'enable_sticky_header' => 'yes',
295 ],
296 ]
297 );
298
299 $this->add_control(
300 'disable_top_padding',
301 [
302 'label' => __( 'Enable Top Padding', 'easy-elements' ),
303 'type' => Controls_Manager::SWITCHER,
304 'label_on' => __( 'Yes', 'easy-elements' ),
305 'label_off' => __( 'No', 'easy-elements' ),
306 'frontend_available' => true,
307 'default' => 'yes',
308 'condition' => [
309 'enable_sticky_header' => 'yes',
310 ],
311 ]
312 );
313
314 $this->add_responsive_control(
315 'dynamic_top_padding_value',
316 [
317 'label' => __( 'Custom Top Padding', 'easy-elements' ),
318 'type' => \Elementor\Controls_Manager::SLIDER,
319 'size_units' => [ 'px' ],
320 'range' => [
321 'px' => [
322 'min' => 0,
323 'max' => 300,
324 ],
325 ],
326 'condition' => [
327 'disable_top_padding' => '',
328 'enable_sticky_header' => 'yes',
329 ],
330 'selectors' => [
331 'body #page' => 'padding-top: {{SIZE}}{{UNIT}};',
332 ],
333 ]
334 );
335
336 $this->end_controls_tab();
337
338 $this->start_controls_tab(
339 'sticky_bg_color_hover_tab',
340 [
341 'label' => __( 'Sticky', 'easy-elements' ),
342 'condition' => [
343 'enable_sticky_header' => 'yes',
344 ],
345 ]
346 );
347 $this->add_control(
348 'bg_color_sticky',
349 [
350 'label' => __( 'Background Color', 'easy-elements' ),
351 'type' => Controls_Manager::COLOR,
352 'default' => '',
353 'selectors' => [
354 'header.eel-sticky-header-on.eel-up-scroll, header.eel-sticky-header-on.eel--fixed-top-sticky' => 'background-color: {{VALUE}} !important',
355 ],
356 'condition' => [
357 'enable_sticky_header' => 'yes',
358 ],
359 ]
360 );
361
362 $this->add_control(
363 'text_color_sticky',
364 [
365 'label' => __( 'Text Color', 'easy-elements' ),
366 'type' => Controls_Manager::COLOR,
367 'default' => '',
368 'selectors' => [
369 'header.eel-sticky-header-on.eel-up-scroll .eel-nav-menu a.eel-menu-item, header.eel-sticky-header-on.eel-up-scroll .eel-nav-menu a.eel-sub-menu-item, .header.eel-sticky-header-on.eel-up-scroll *, header.eel-sticky-header-on.eel--fixed-top-sticky .eel-nav-menu a.eel-menu-item, header.eel-sticky-header-on.eel--fixed-top-sticky .eel-nav-menu a.eel-sub-menu-item, .header.eel-sticky-header-on.eel--fixed-top-sticky *' => 'color: {{VALUE}} !important',
370 ],
371 'condition' => [
372 'enable_sticky_header' => 'yes',
373 ],
374 ]
375 );
376 $this->add_group_control(
377 \Elementor\Group_Control_Box_Shadow::get_type(),
378 [
379 'name' => 'box_shadow',
380 'selector' => 'body header.eel-sticky-header-on.eel-up-scroll, body header.eel-sticky-header-on.eel--fixed-top-sticky',
381 'condition' => [
382 'enable_sticky_header' => 'yes',
383 ],
384 ]
385 );
386
387 $current_theme = wp_get_theme();
388
389 if ( 'Twenty Twenty-One' === $current_theme->get( 'Name' ) ) {
390 $this->add_control(
391 'hide_theme_icons',
392 [
393 'label' => __( 'Hide + & - Sign', 'easy-elements' ),
394 'type' => Controls_Manager::SWITCHER,
395 'label_on' => __( 'Yes', 'easy-elements' ),
396 'label_off' => __( 'No', 'easy-elements' ),
397 'return_value' => 'yes',
398 'default' => 'no',
399 'prefix_class' => 'eel-nav-menu__theme-icon-',
400 ]
401 );
402 }
403
404 $this->end_controls_tab();
405
406 $this->end_controls_tabs();
407
408 $this->end_controls_section();
409
410 $this->start_controls_section(
411 'section_layout',
412 [
413 'label' => __( 'Layout Settings', 'easy-elements' ),
414 ]
415 );
416
417 $this->add_control(
418 'layout',
419 [
420 'label' => __( 'Layout', 'easy-elements' ),
421 'type' => Controls_Manager::SELECT,
422 'default' => 'horizontal',
423 'options' => [
424 'horizontal' => __( 'Horizontal', 'easy-elements' ),
425 'vertical' => __( 'Vertical', 'easy-elements' ),
426 ],
427 ]
428 );
429
430 $this->add_responsive_control(
431 'navmenu_align',
432 [
433 'label' => __( 'Alignment', 'easy-elements' ),
434 'type' => Controls_Manager::CHOOSE,
435 'options' => [
436 'left' => [
437 'title' => __( 'Left', 'easy-elements' ),
438 'icon' => 'eicon-h-align-left',
439 ],
440 'center' => [
441 'title' => __( 'Center', 'easy-elements' ),
442 'icon' => 'eicon-h-align-center',
443 ],
444 'right' => [
445 'title' => __( 'Right', 'easy-elements' ),
446 'icon' => 'eicon-h-align-right',
447 ],
448 'justify' => [
449 'title' => __( 'Justify', 'easy-elements' ),
450 'icon' => 'eicon-h-align-stretch',
451 ],
452 ],
453 'default' => 'left',
454 'condition' => [
455 'layout' => 'horizontal',
456 ],
457 'selectors_dictionary' => [
458 'left' => 'flex-start',
459 'center' => 'center',
460 'right' => 'flex-end',
461 'justify' => 'space-between',
462 ],
463 'selectors' => [
464 '{{WRAPPER}} .eel-nav-menu__layout-horizontal, {{WRAPPER}} .eel-nav-menu__layout-horizontal .eel-nav-menu' => 'justify-content: {{VALUE}};',
465 ],
466 ]
467 );
468
469
470 $this->add_responsive_control(
471 'navmenu_align_text',
472 [
473 'label' => __( 'Menu Alignment', 'easy-elements' ),
474 'type' => \Elementor\Controls_Manager::CHOOSE,
475 'options' => [
476 'left' => [
477 'title' => __( 'Left', 'easy-elements' ),
478 'icon' => 'eicon-h-align-left',
479 ],
480 'center' => [
481 'title' => __( 'Center', 'easy-elements' ),
482 'icon' => 'eicon-h-align-center',
483 ],
484 'right' => [
485 'title' => __( 'Right', 'easy-elements' ),
486 'icon' => 'eicon-h-align-right',
487 ],
488 'justify' => [
489 'title' => __( 'Justify', 'easy-elements' ),
490 'icon' => 'eicon-h-align-stretch',
491 ],
492 ],
493 'default' => '',
494 'condition' => [
495 'layout' => [ 'vertical' ],
496 ],
497 'selectors' => [
498 '{{WRAPPER}} .eel-nav-menu li.menu-item' => 'text-align: {{VALUE}};',
499 '{{WRAPPER}} .eel-nav-menu li.menu-item a' => 'max-width: 100%; width: auto; display: block;',
500 ],
501 ]
502 );
503
504 $this->add_control(
505 'submenu_animation',
506 [
507 'label' => __( 'Dropdown Animation', 'easy-elements' ),
508 'type' => Controls_Manager::SELECT,
509 'default' => 'eel_animation_slide_down',
510 'options' => [
511 'eel_animation_slide_down' => __( 'Animation Down', 'easy-elements' ),
512 'eel_animation_slide_up' => __( 'Animation Up', 'easy-elements' ),
513 'eel_animation_fade' => __( 'Animation Fade', 'easy-elements' ),
514 'eel_animation_right' => __( 'Animation Right', 'easy-elements' ),
515 'eel_animation_left' => __( 'Animation Left', 'easy-elements' ),
516 'eel_animation_zoom' => __( 'Animation Zoom', 'easy-elements' ),
517 ],
518 'condition' => [
519 'layout' => 'horizontal',
520 ],
521 ]
522 );
523
524 $this->add_control(
525 'menu_icon_vertical',
526 [
527 'label' => __('Icon', 'easy-elements'),
528 'type' => Controls_Manager::ICONS,
529 'condition' => [
530 'layout' => 'vertical',
531 ],
532 ]
533 );
534
535 $this->add_responsive_control(
536 'icon_alignment_vertical',
537 [
538 'label' => __( 'Alignment', 'easy-elements' ),
539 'type' => \Elementor\Controls_Manager::CHOOSE,
540 'options' => [
541 'align_left' => [
542 'title' => __( 'Left', 'easy-elements' ),
543 'icon' => 'eicon-h-align-left',
544 ],
545 'align_right' => [
546 'title' => __( 'Right', 'easy-elements' ),
547 'icon' => 'eicon-h-align-right',
548 ],
549 ],
550 'default' => 'align_left',
551 'condition' => [
552 'layout' => 'vertical',
553 ],
554 'selectors_dictionary' => [
555 'align_left' => '-1',
556 'align_right' => '1',
557 ],
558 'selectors' => [
559 '{{WRAPPER}} .eel-layout-vertical .eel-nav-menu li>.eel-menu-item .eel-menu-dynamic-icon' => 'order: {{VALUE}};',
560 ],
561 ]
562 );
563
564 $this->add_responsive_control(
565 'icon_margin_vertical',
566 [
567 'label' => esc_html__( 'Margin', 'easy-elements' ),
568 'type' => \Elementor\Controls_Manager::DIMENSIONS,
569 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
570 'selectors' => [
571 '{{WRAPPER}} .eel-layout-vertical .eel-nav-menu li>.eel-menu-item .eel-menu-dynamic-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
572 ],
573 'condition' => [
574 'layout' => 'vertical',
575 ],
576 ]
577 );
578
579 $this->add_control(
580 'heading_responsive',
581 [
582 'type' => Controls_Manager::HEADING,
583 'label' => __( 'Responsive Menu Settings', 'easy-elements' ),
584 'separator' => 'before',
585 'condition' => [
586 'layout' => [ 'horizontal' ],
587 ],
588 ]
589 );
590
591 $this->add_control(
592 'dropdown',
593 [
594 'label' => __( 'Breakpoint', 'easy-elements' ),
595 'type' => Controls_Manager::SELECT,
596 'default' => 'tablet',
597 'options' => [
598 'tablet' => __( 'Tablet (1025px >)', 'easy-elements' ),
599 'none' => __( 'None', 'easy-elements' ),
600 ],
601 'prefix_class' => 'eel-nav-menu__breakpoint-',
602 'condition' => [
603 'layout' => [ 'horizontal' ],
604 ],
605 'render_type' => 'template',
606 ]
607 );
608
609 $this->add_control(
610 'mobile_menu_open_position',
611 [
612 'label' => __( 'Mobile Menu Open Position', 'easy-elements' ),
613 'type' => Controls_Manager::SELECT,
614 'default' => 'right',
615 'options' => [
616 'top' => __( 'Top', 'easy-elements' ),
617 'right' => __( 'Right', 'easy-elements' ),
618 ],
619 'condition' => [
620 'layout' => [ 'horizontal' ],
621 ],
622 ]
623 );
624
625 $this->add_responsive_control(
626 'mobile_nav_sidebar_width',
627 [
628 'label' => __( 'Menu Sidebar Width', 'easy-elements' ),
629 'type' => \Elementor\Controls_Manager::SLIDER,
630 'size_units' => [ 'px', '%', 'vw' ],
631 'range' => [
632 'px' => [
633 'min' => 200,
634 'max' => 500,
635 ],
636 '%' => [
637 'min' => 50,
638 'max' => 100,
639 ],
640 'vw' => [
641 'min' => 20,
642 'max' => 100,
643 ],
644 ],
645 'selectors' => [
646 '.sidebar-on-mobile[data-nav-id="{{ID}}"]' => 'max-width: {{SIZE}}{{UNIT}} !important;',
647 ],
648 ]
649 );
650
651
652 $this->start_controls_tabs( 'tabs_menu_item_style_mobile' );
653
654 $this->start_controls_tab(
655 'tab_menu_item_normal_m',
656 [
657 'label' => __( 'Normal', 'easy-elements' ),
658 'condition' => [
659 'layout' => [ 'horizontal' ],
660 ],
661 ]
662 );
663
664 $this->add_control(
665 'color_menu_item_m',
666 [
667 'label' => __( 'Text Color', 'easy-elements' ),
668 'type' => Controls_Manager::COLOR,
669 'selectors' => [
670 '.sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item a' => 'color: {{VALUE}} !important;',
671 ],
672 'condition' => [
673 'layout' => [ 'horizontal' ],
674 ],
675 ]
676 );
677
678 $this->add_control(
679 'bg_color_full',
680 [
681 'label' => esc_html__( 'Background Color (Full Sidebar)', 'easy-elements' ),
682 'type' => Controls_Manager::COLOR,
683 'selectors' => [
684 '.sidebar-on-mobile[data-nav-id="{{ID}}"]' => 'background-color: {{VALUE}};',
685 ],
686 ]
687 );
688
689 $this->add_control(
690 'dropdown_item_bg',
691 [
692 'label' => esc_html__( 'Background Color', 'easy-elements' ),
693 'type' => Controls_Manager::COLOR,
694 'selectors' => [
695 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .sub-menu:not(.easyel--elementor-template-mega-menu) li > a' => 'background-color: {{VALUE}};',
696 ],
697 ]
698 );
699
700 $this->add_group_control(
701 \Elementor\Group_Control_Typography::get_type(),
702 [
703 'name' => 'color_menu_item_m_typography',
704 'label' => esc_html__('Typography', 'easy-elements' ),
705 'selector' => '.sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item a',
706 'condition' => [
707 'layout' => [ 'horizontal' ],
708 ],
709 ]
710 );
711
712 $this->end_controls_tab();
713
714 $this->start_controls_tab(
715 'tab_menu_item_hover_m',
716 [
717 'label' => __( 'Hover', 'easy-elements' ),
718 'condition' => [
719 'layout' => [ 'horizontal' ],
720 ],
721 ]
722 );
723
724 $this->add_control(
725 'color_menu_item_hover_m',
726 [
727 'label' => __( 'Text Color', 'easy-elements' ),
728 'type' => Controls_Manager::COLOR,
729 'selectors' => [
730 '.sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item a:hover, .sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item a.highlighted' => 'color: {{VALUE}} !important;',
731 ],
732 'condition' => [
733 'layout' => [ 'horizontal' ],
734 ],
735 ]
736 );
737
738 $this->add_control(
739 'dropdown_item_bg_hover',
740 [
741 'label' => esc_html__( 'Background Color', 'easy-elements' ),
742 'type' => Controls_Manager::COLOR,
743 'selectors' => [
744 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .sub-menu:not(.easyel--elementor-template-mega-menu) li > a:hover' => 'background-color: {{VALUE}};',
745 ],
746 ]
747 );
748
749 $this->end_controls_tab();
750
751 $this->start_controls_tab(
752 'tab_menu_item_active_m',
753 [
754 'label' => __( 'Active', 'easy-elements' ),
755 'condition' => [
756 'layout' => [ 'horizontal' ],
757 ],
758 ]
759 );
760
761 $this->add_control(
762 'color_menu_item_active_m',
763 [
764 'label' => __( 'Text Color', 'easy-elements' ),
765 'type' => Controls_Manager::COLOR,
766 'selectors' => [
767 '.sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item.current-menu-item a, .sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item.current-menu-ancestor a, .sidebar-on-mobile[data-nav-id="{{ID}}"] li.menu-item a.eel-active' => 'color: {{VALUE}} !important;',
768 ],
769 'condition' => [
770 'layout' => [ 'horizontal' ],
771 ],
772 ]
773 );
774
775 $this->add_control(
776 'dropdown_item_bg_active',
777 [
778 'label' => esc_html__( 'Background Color', 'easy-elements' ),
779 'type' => Controls_Manager::COLOR,
780 'selectors' => [
781 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .sub-menu:not(.easyel--elementor-template-mega-menu) li.current-menu-item > a' => 'background-color: {{VALUE}};',
782 ],
783 ]
784 );
785
786
787 $this->end_controls_tab();
788
789 $this->end_controls_tabs();
790
791 $this->add_responsive_control(
792 'resp_align',
793 [
794 'label' => __( 'Hamburger Alignment', 'easy-elements' ),
795 'type' => Controls_Manager::CHOOSE,
796 'options' => [
797 'left' => [
798 'title' => __( 'Left', 'easy-elements' ),
799 'icon' => 'eicon-h-align-left',
800 ],
801 'center' => [
802 'title' => __( 'Center', 'easy-elements' ),
803 'icon' => 'eicon-h-align-center',
804 ],
805 'right' => [
806 'title' => __( 'Right', 'easy-elements' ),
807 'icon' => 'eicon-h-align-right',
808 ],
809 ],
810 'default' => 'right',
811 'description' => __( 'This is the alignment of menu icon on selected responsive breakpoints.', 'easy-elements' ),
812 'condition' => [
813 'layout' => [ 'horizontal' ],
814 'dropdown!' => 'none',
815 ],
816 'selectors_dictionary' => [
817 'left' => 'margin-right: auto',
818 'center' => 'margin: 0 auto',
819 'right' => 'margin-left: auto',
820 ],
821 'selectors' => [
822 '{{WRAPPER}} .eel-nav-menu__toggle' => '{{VALUE}}',
823 ],
824 ]
825 );
826
827
828 $this->add_control(
829 'dropdown_icon',
830 [
831 'label' => __( 'Choose Hamburger Icon', 'easy-elements' ),
832 'type' => Controls_Manager::ICONS,
833 'label_block' => 'true',
834 'default' => [
835 'value' => 'fas fa-align-justify',
836 'library' => 'fa-solid',
837 ],
838 'condition' => [
839 'layout' => [ 'horizontal' ],
840 'dropdown!' => 'none',
841 ],
842 ]
843 );
844
845 $this->add_control(
846 'mobile_close_icon',
847 [
848 'label' => esc_html__( 'Choose Close Icon', 'easy-elements' ),
849 'type' => \Elementor\Controls_Manager::ICONS,
850 'fa4compatibility' => 'icon',
851 'default' => [],
852 'condition' => [
853 'layout' => [ 'horizontal' ],
854 'dropdown!' => 'none',
855 ]
856 ]
857 );
858
859 $this->end_controls_section();
860 }
861
862 /**
863 * Register Nav Menu General Controls.
864 *
865 * @since 1.3.0
866 * @access protected
867 * @return void
868 */
869 protected function register_style_content_controls() {
870
871 $this->start_controls_section(
872 'section_style_main-menu',
873 [
874 'label' => __( 'Main Menu', 'easy-elements' ),
875 'tab' => Controls_Manager::TAB_STYLE,
876 ]
877 );
878
879 $this->add_responsive_control(
880 'item_menu_padding',
881 [
882 'label' => esc_html__( 'Padding', 'easy-elements' ),
883 'type' => Controls_Manager::DIMENSIONS,
884 'selectors' => [
885 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' =>
886 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
887 ],
888 ]
889 );
890
891 $this->add_responsive_control(
892 'item_menu_padding_top',
893 [
894 'label' => esc_html__( 'Padding Top', 'easy-elements' ),
895 'type' => Controls_Manager::SLIDER,
896 'size_units' => [ 'px', 'em', '%' ],
897 'range' => [
898 'px' => [ 'min' => 0, 'max' => 200 ],
899 'em' => [ 'min' => 0, 'max' => 20 ],
900 '%' => [ 'min' => 0, 'max' => 100 ],
901 ],
902 'selectors' => [
903 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'padding-top: {{SIZE}}{{UNIT}};',
904 ],
905 ]
906 );
907
908 $this->add_responsive_control(
909 'item_menu_padding_right',
910 [
911 'label' => esc_html__( 'Padding Right', 'easy-elements' ),
912 'type' => Controls_Manager::SLIDER,
913 'size_units' => [ 'px', 'em', '%' ],
914 'range' => [
915 'px' => [ 'min' => 0, 'max' => 200 ],
916 'em' => [ 'min' => 0, 'max' => 20 ],
917 '%' => [ 'min' => 0, 'max' => 100 ],
918 ],
919 'selectors' => [
920 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'padding-right: {{SIZE}}{{UNIT}};',
921 ],
922 ]
923 );
924
925 $this->add_responsive_control(
926 'item_menu_padding_bottom',
927 [
928 'label' => esc_html__( 'Padding Bottom', 'easy-elements' ),
929 'type' => Controls_Manager::SLIDER,
930 'size_units' => [ 'px', 'em', '%' ],
931 'range' => [
932 'px' => [ 'min' => 0, 'max' => 200 ],
933 'em' => [ 'min' => 0, 'max' => 20 ],
934 '%' => [ 'min' => 0, 'max' => 100 ],
935 ],
936 'selectors' => [
937 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'padding-bottom: {{SIZE}}{{UNIT}};',
938 ],
939 ]
940 );
941
942 $this->add_responsive_control(
943 'item_menu_padding_left',
944 [
945 'label' => esc_html__( 'Padding Left', 'easy-elements' ),
946 'type' => Controls_Manager::SLIDER,
947 'size_units' => [ 'px', 'em', '%' ],
948 'range' => [
949 'px' => [ 'min' => 0, 'max' => 200 ],
950 'em' => [ 'min' => 0, 'max' => 20 ],
951 '%' => [ 'min' => 0, 'max' => 100 ],
952 ],
953 'selectors' => [
954 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'padding-left: {{SIZE}}{{UNIT}};',
955 ],
956 ]
957 );
958
959 $this->add_responsive_control(
960 'item_menu_margin',
961 [
962 'label' => esc_html__( 'Margin', 'easy-elements' ),
963 'type' => Controls_Manager::DIMENSIONS,
964 'selectors' => [
965 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' =>
966 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
967 ],
968 ]
969 );
970
971 $this->add_control(
972 'style_divider',
973 [
974 'type' => Controls_Manager::DIVIDER,
975 ]
976 );
977
978 $this->add_group_control(
979 Group_Control_Typography::get_type(),
980 [
981 'name' => 'menu_typography',
982 'separator' => 'before',
983 'selector' => '{{WRAPPER}} a.eel-menu-item, {{WRAPPER}} a.eel-sub-menu-item',
984 ]
985 );
986
987 $this->start_controls_tabs( 'tabs_menu_item_style' );
988
989 $this->start_controls_tab(
990 'tab_menu_item_normal',
991 [
992 'label' => __( 'Normal', 'easy-elements' ),
993 ]
994 );
995
996 $this->add_control(
997 'color_menu_item',
998 [
999 'label' => __( 'Text Color', 'easy-elements' ),
1000 'type' => Controls_Manager::COLOR,
1001 'default' => '',
1002 'selectors' => [
1003 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'color: {{VALUE}}',
1004 ],
1005 ]
1006 );
1007
1008 $this->add_control(
1009 'bg_color_menu_item',
1010 [
1011 'label' => __( 'Background Color', 'easy-elements' ),
1012 'type' => Controls_Manager::COLOR,
1013 'default' => '',
1014 'selectors' => [
1015 '{{WRAPPER}} .eel-nav-menu > .menu-item > a.eel-menu-item' => 'background-color: {{VALUE}}',
1016 ],
1017 ]
1018 );
1019
1020 $this->end_controls_tab();
1021
1022 $this->start_controls_tab(
1023 'tab_menu_item_hover',
1024 [
1025 'label' => __( 'Hover', 'easy-elements' ),
1026 ]
1027 );
1028
1029 $this->add_control(
1030 'color_menu_item_hover',
1031 [
1032 'label' => __( 'Text Color', 'easy-elements' ),
1033 'type' => Controls_Manager::COLOR,
1034 'selectors' => [
1035 '{{WRAPPER}} .eel-nav-menu > .menu-item:hover > a.eel-menu-item' => 'color: {{VALUE}}',
1036 ],
1037 ]
1038 );
1039
1040 $this->add_control(
1041 'bg_color_menu_item_hover',
1042 [
1043 'label' => __( 'Background Color', 'easy-elements' ),
1044 'type' => Controls_Manager::COLOR,
1045 'selectors' => [
1046 '{{WRAPPER}} .eel-nav-menu > .menu-item:hover > a.eel-menu-item' => 'background-color: {{VALUE}}',
1047 ],
1048 ]
1049 );
1050
1051 $this->end_controls_tab();
1052
1053 $this->start_controls_tab(
1054 'tab_menu_item_active',
1055 [
1056 'label' => __( 'Active', 'easy-elements' ),
1057 ]
1058 );
1059
1060 $this->add_control(
1061 'color_menu_item_active',
1062 [
1063 'label' => __( 'Text Color', 'easy-elements' ),
1064 'type' => Controls_Manager::COLOR,
1065 'default' => '',
1066 'selectors' => [
1067 '{{WRAPPER}} .eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu > .menu-item.current_page_item > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu > .menu-item.current-menu-ancestor > a.eel-menu-item' => 'color: {{VALUE}}',
1068 ],
1069 ]
1070 );
1071
1072 $this->add_control(
1073 'bg_color_menu_item_active',
1074 [
1075 'label' => __( 'Background Color', 'easy-elements' ),
1076 'type' => Controls_Manager::COLOR,
1077 'default' => '',
1078 'selectors' => [
1079 '{{WRAPPER}} .eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu > .menu-item.current_page_item > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu > .menu-item.current-menu-ancestor > a.eel-menu-item' => 'background-color: {{VALUE}}',
1080 ],
1081 ]
1082 );
1083
1084 $this->end_controls_tab();
1085 $this->end_controls_tabs();
1086 $this->end_controls_section();
1087 }
1088
1089 /**
1090 * Register Nav Menu General Controls.
1091 *
1092 * @since 1.3.0
1093 * @access protected
1094 * @return void
1095 */
1096 protected function register_dropdown_content_controls() {
1097 $this->start_controls_section(
1098 'section_style_dropdown',
1099 [
1100 'label' => __( 'Dropdown', 'easy-elements' ),
1101 'tab' => Controls_Manager::TAB_STYLE,
1102 'condition' => [
1103 'layout' => ['horizontal'],
1104 ],
1105 ]
1106 );
1107
1108 $this->add_control(
1109 'dropdown_description',
1110 [
1111 'raw'=> __( '<b>Note:</b> On desktop, below style options will apply to the submenu. On mobile, this will apply to the entire menu.', 'easy-elements' ),
1112 'type' => Controls_Manager::RAW_HTML,
1113 'content_classes' => 'elementor-descriptor',
1114 ]
1115 );
1116
1117 $this->start_controls_tabs( 'tabs_dropdown_item_style' );
1118
1119 $this->start_controls_tab(
1120 'tab_dropdown_item_normal',
1121 [
1122 'label' => __( 'Normal', 'easy-elements' ),
1123 ]
1124 );
1125
1126 $this->add_control(
1127 'color_dropdown_item',
1128 [
1129 'label' => __( 'Text Color', 'easy-elements' ),
1130 'type' => Controls_Manager::COLOR,
1131 'default' => '',
1132 'selectors' => [
1133 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'color: {{VALUE}}',
1134 ],
1135 ]
1136 );
1137
1138 $this->add_control(
1139 'background_color_dropdown_item',
1140 [
1141 'label' => __( 'Background Color', 'easy-elements' ),
1142 'type' => Controls_Manager::COLOR,
1143 'default' => '#fff',
1144 'selectors' => [
1145 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'background-color: {{VALUE}}',
1146 ],
1147 'separator' => 'after',
1148 ]
1149 );
1150
1151 $this->end_controls_tab();
1152
1153 $this->start_controls_tab(
1154 'tab_dropdown_item_hover',
1155 [
1156 'label' => __( 'Hover', 'easy-elements' ),
1157 ]
1158 );
1159
1160 $this->add_control(
1161 'color_dropdown_item_hover',
1162 [
1163 'label' => __( 'Text Color', 'easy-elements' ),
1164 'type' => Controls_Manager::COLOR,
1165 'default' => '',
1166 'selectors' => [
1167 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item:hover > a' => 'color: {{VALUE}}',
1168 ],
1169 ]
1170 );
1171
1172 $this->add_control(
1173 'background_color_dropdown_item_hover',
1174 [
1175 'label' => __( 'Background Color', 'easy-elements' ),
1176 'type' => Controls_Manager::COLOR,
1177 'default' => '',
1178 'selectors' => [
1179 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item:hover > a' => 'background-color: {{VALUE}}',
1180 ],
1181 'separator' => 'after',
1182 ]
1183 );
1184
1185 $this->end_controls_tab();
1186
1187 $this->start_controls_tab(
1188 'tab_dropdown_item_active',
1189 [
1190 'label' => __( 'Active', 'easy-elements' ),
1191 ]
1192 );
1193
1194 $this->add_control(
1195 'color_dropdown_item_active',
1196 [
1197 'label' => __( 'Text Color', 'easy-elements' ),
1198 'type' => Controls_Manager::COLOR,
1199 'default' => '',
1200 'selectors' => [
1201 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current-menu-item > a, {{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current_page_item > a, {{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current-menu-ancestor > a
1202 ' => 'color: {{VALUE}}',
1203
1204 ],
1205 ]
1206 );
1207
1208 $this->add_control(
1209 'background_color_dropdown_item_active',
1210 [
1211 'label' => __( 'Background Color', 'easy-elements' ),
1212 'type' => Controls_Manager::COLOR,
1213 'default' => '',
1214 'selectors' => [
1215 '{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current-menu-item > a, {{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current_page_item > a, {{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item.current-menu-ancestor > a' => 'background-color: {{VALUE}}',
1216 ],
1217 'separator' => 'after',
1218
1219 ]
1220 );
1221 $this->end_controls_tab();
1222 $this->end_controls_tabs();
1223
1224 $this->add_group_control(
1225 Group_Control_Typography::get_type(),
1226 [
1227 'name' => 'dropdown_typography',
1228 'separator' => 'before',
1229 'selector' => '
1230 {{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a',
1231 'condition' => [
1232 'layout' => 'horizontal',
1233 ],
1234 ]
1235 );
1236
1237 $this->add_group_control(
1238 \Elementor\Group_Control_Border::get_type(),
1239 [
1240 'name' => 'dropdown_item_border',
1241 'selector' => '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a',
1242 'condition' => [
1243 'layout' => 'horizontal',
1244 ],
1245 ]
1246 );
1247
1248 $this->add_responsive_control(
1249 'item__full_padding',
1250 [
1251 'label' => esc_html__( 'Padding', 'easy-elements' ),
1252 'type' => Controls_Manager::DIMENSIONS,
1253 'size_units' => [ 'px', 'em', '%' ],
1254 'selectors' => [
1255 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1256 ],
1257 'condition' => [
1258 'layout' => 'horizontal',
1259 ],
1260 ]
1261 );
1262
1263 $this->add_responsive_control(
1264 'item__full_padding_top',
1265 [
1266 'label' => esc_html__( 'Padding Top', 'easy-elements' ),
1267 'type' => Controls_Manager::SLIDER,
1268 'size_units' => [ 'px', 'em', '%' ],
1269 'range' => [
1270 'px' => [ 'min' => 0, 'max' => 200 ],
1271 'em' => [ 'min' => 0, 'max' => 20 ],
1272 '%' => [ 'min' => 0, 'max' => 100 ],
1273 ],
1274 'selectors' => [
1275 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'padding-top: {{SIZE}}{{UNIT}};',
1276 ],
1277 'condition' => [
1278 'layout' => 'horizontal',
1279 ],
1280 ]
1281 );
1282
1283 $this->add_responsive_control(
1284 'item__full_padding_right',
1285 [
1286 'label' => esc_html__( 'Padding Right', 'easy-elements' ),
1287 'type' => Controls_Manager::SLIDER,
1288 'size_units' => [ 'px', 'em', '%' ],
1289 'range' => [
1290 'px' => [ 'min' => 0, 'max' => 200 ],
1291 'em' => [ 'min' => 0, 'max' => 20 ],
1292 '%' => [ 'min' => 0, 'max' => 100 ],
1293 ],
1294 'selectors' => [
1295 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'padding-right: {{SIZE}}{{UNIT}};',
1296 ],
1297 'condition' => [
1298 'layout' => 'horizontal',
1299 ],
1300 ]
1301 );
1302
1303 $this->add_responsive_control(
1304 'item__full_padding_bottom',
1305 [
1306 'label' => esc_html__( 'Padding Bottom', 'easy-elements' ),
1307 'type' => Controls_Manager::SLIDER,
1308 'size_units' => [ 'px', 'em', '%' ],
1309 'range' => [
1310 'px' => [ 'min' => 0, 'max' => 200 ],
1311 'em' => [ 'min' => 0, 'max' => 20 ],
1312 '%' => [ 'min' => 0, 'max' => 100 ],
1313 ],
1314 'selectors' => [
1315 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'padding-bottom: {{SIZE}}{{UNIT}};',
1316 ],
1317 'condition' => [
1318 'layout' => 'horizontal',
1319 ],
1320 ]
1321 );
1322
1323 $this->add_responsive_control(
1324 'item__full_padding_left',
1325 [
1326 'label' => esc_html__( 'Padding Left', 'easy-elements' ),
1327 'type' => Controls_Manager::SLIDER,
1328 'size_units' => [ 'px', 'em', '%' ],
1329 'range' => [
1330 'px' => [ 'min' => 0, 'max' => 200 ],
1331 'em' => [ 'min' => 0, 'max' => 20 ],
1332 '%' => [ 'min' => 0, 'max' => 100 ],
1333 ],
1334 'selectors' => [
1335 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu) .menu-item > a' => 'padding-left: {{SIZE}}{{UNIT}};',
1336 ],
1337 'condition' => [
1338 'layout' => 'horizontal',
1339 ],
1340 ]
1341 );
1342
1343 $this->add_responsive_control(
1344 'width_dropdown_item',
1345 [
1346 'label' => __( 'Dropdown Width (px)', 'easy-elements' ),
1347 'type' => Controls_Manager::SLIDER,
1348 'range' => [
1349 'px' => [
1350 'min' => 0,
1351 'max' => 500,
1352 ],
1353 ],
1354 'default' => [
1355 'size' => '220',
1356 'unit' => 'px',
1357 ],
1358 'selectors' => [
1359 '{{WRAPPER}} ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'width: {{SIZE}}{{UNIT}}',
1360 ],
1361 'condition' => [
1362 'layout' => 'horizontal',
1363 ],
1364 'frontend_available' => true,
1365 ]
1366 );
1367
1368 $this->add_responsive_control(
1369 'icon_size',
1370 [
1371 'label' => __( 'Icon Size', 'easy-elements' ),
1372 'type' => Controls_Manager::SLIDER,
1373 'range' => [
1374 'px' => [
1375 'min' => 15,
1376 'max' => 25,
1377 ],
1378 ],
1379 'selectors' => [
1380 '{{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item::before' => 'font-size: {{SIZE}}px;',
1381 ],
1382 'condition' => [
1383 'layout' => [ 'horizontal' ],
1384 ],
1385 'frontend_available' => true,
1386 ]
1387 );
1388
1389 $this->add_responsive_control(
1390 'icon_distance_from_menu',
1391 [
1392 'label' => __( 'Icon Top Distance', 'easy-elements' ),
1393 'type' => Controls_Manager::SLIDER,
1394 'range' => [
1395 'px' => [
1396 'min' => -100,
1397 'max' => 100,
1398 ],
1399 ],
1400 'selectors' => [
1401 '{{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item::before' => 'top: {{SIZE}}%;',
1402 ],
1403 'condition' => [
1404 'layout' => [ 'horizontal' ],
1405 ],
1406 'frontend_available' => true,
1407 ]
1408 );
1409
1410 $this->add_responsive_control(
1411 'icon_left_right_from_menu',
1412 [
1413 'label' => __( 'Icon Right Distance', 'easy-elements' ),
1414 'type' => Controls_Manager::SLIDER,
1415 'range' => [
1416 'px' => [
1417 'min' => -100,
1418 'max' => 100,
1419 ],
1420 ],
1421 'selectors' => [
1422 '{{WRAPPER}} .eel-nav-menu .menu-item-has-children>a:before' => 'right: {{SIZE}}px;',
1423 ],
1424 'condition' => [
1425 'layout' => [ 'horizontal' ],
1426 ],
1427 'frontend_available' => true,
1428 ]
1429 );
1430
1431 $this->add_control(
1432 'full_heading',
1433 [
1434 'label' => esc_html__( 'Dropdown Wrapper', 'easy-elements' ),
1435 'type' => \Elementor\Controls_Manager::HEADING,
1436 'separator' => 'after',
1437 ]
1438 );
1439
1440 $this->add_control(
1441 'background_color_wrapper',
1442 [
1443 'label' => __( 'Background Color', 'easy-elements' ),
1444 'type' => Controls_Manager::COLOR,
1445 'description' => __( 'Note: If you use a background color on individual items, It will not be visible on the wrapper.', 'easy-elements' ),
1446 'selectors' => [
1447 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'background-color: {{VALUE}}',
1448 ],
1449 ]
1450 );
1451
1452 $this->add_control(
1453 'dropdown_border_radius',
1454 [
1455 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1456 'type' => Controls_Manager::DIMENSIONS,
1457 'selectors' => [
1458 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu), {{WRAPPER}} .eel-nav-menu .sub-menu li.menu-item' =>
1459 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1460 ],
1461 'description' => esc_html__( 'Note: Border radius will only be visible if you apply a background color to the wrapper.', 'easy-elements' ),
1462 'condition' => [
1463 'layout' => 'horizontal',
1464 ],
1465 ]
1466 );
1467
1468 $this->add_responsive_control(
1469 'ul__full_padding',
1470 [
1471 'label' => esc_html__( 'Padding', 'easy-elements' ),
1472 'type' => Controls_Manager::DIMENSIONS,
1473 'size_units' => [ 'px', 'em', '%' ],
1474 'selectors' => [
1475 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1476 ],
1477 'condition' => [
1478 'layout' => 'horizontal',
1479 ],
1480 ]
1481 );
1482
1483 $this->add_responsive_control(
1484 'ul__full_padding_top',
1485 [
1486 'label' => esc_html__( 'Padding Top', 'easy-elements' ),
1487 'type' => Controls_Manager::SLIDER,
1488 'size_units' => [ 'px', 'em', '%' ],
1489 'range' => [
1490 'px' => [ 'min' => 0, 'max' => 200 ],
1491 'em' => [ 'min' => 0, 'max' => 20 ],
1492 '%' => [ 'min' => 0, 'max' => 100 ],
1493 ],
1494 'selectors' => [
1495 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'padding-top: {{SIZE}}{{UNIT}};',
1496 ],
1497 'condition' => [
1498 'layout' => 'horizontal',
1499 ],
1500 ]
1501 );
1502
1503 $this->add_responsive_control(
1504 'ul__full_padding_right',
1505 [
1506 'label' => esc_html__( 'Padding Right', 'easy-elements' ),
1507 'type' => Controls_Manager::SLIDER,
1508 'size_units' => [ 'px', 'em', '%' ],
1509 'range' => [
1510 'px' => [ 'min' => 0, 'max' => 200 ],
1511 'em' => [ 'min' => 0, 'max' => 20 ],
1512 '%' => [ 'min' => 0, 'max' => 100 ],
1513 ],
1514 'selectors' => [
1515 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'padding-right: {{SIZE}}{{UNIT}};',
1516 ],
1517 'condition' => [
1518 'layout' => 'horizontal',
1519 ],
1520 ]
1521 );
1522
1523 $this->add_responsive_control(
1524 'ul__full_padding_bottom',
1525 [
1526 'label' => esc_html__( 'Padding Bottom', 'easy-elements' ),
1527 'type' => Controls_Manager::SLIDER,
1528 'size_units' => [ 'px', 'em', '%' ],
1529 'range' => [
1530 'px' => [ 'min' => 0, 'max' => 200 ],
1531 'em' => [ 'min' => 0, 'max' => 20 ],
1532 '%' => [ 'min' => 0, 'max' => 100 ],
1533 ],
1534 'selectors' => [
1535 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'padding-bottom: {{SIZE}}{{UNIT}};',
1536 ],
1537 'condition' => [
1538 'layout' => 'horizontal',
1539 ],
1540 ]
1541 );
1542
1543 $this->add_responsive_control(
1544 'ul__full_padding_left',
1545 [
1546 'label' => esc_html__( 'Padding Left', 'easy-elements' ),
1547 'type' => Controls_Manager::SLIDER,
1548 'size_units' => [ 'px', 'em', '%' ],
1549 'range' => [
1550 'px' => [ 'min' => 0, 'max' => 200 ],
1551 'em' => [ 'min' => 0, 'max' => 20 ],
1552 '%' => [ 'min' => 0, 'max' => 100 ],
1553 ],
1554 'selectors' => [
1555 '{{WRAPPER}} .eel-nav-menu ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'padding-left: {{SIZE}}{{UNIT}};',
1556 ],
1557 'condition' => [
1558 'layout' => 'horizontal',
1559 ],
1560 ]
1561 );
1562
1563 $this->add_group_control(
1564 Group_Control_Box_Shadow::get_type(),
1565 [
1566 'name' => 'dropdown_box_shadow',
1567 'selector' => '{{WRAPPER}} .eel-nav-menu .sub-menu:not(.easyel--elementor-template-mega-menu)',
1568 'separator' => 'after',
1569 'condition' => [
1570 'layout' => 'horizontal',
1571 ],
1572 ]
1573 );
1574
1575 $this->end_controls_section();
1576
1577 $this->start_controls_section(
1578 'style_toggle',
1579 [
1580 'label' => __( 'Menu Trigger', 'easy-elements' ),
1581 'tab' => Controls_Manager::TAB_STYLE,
1582 ]
1583 );
1584
1585 $this->start_controls_tabs( 'tabs_toggle_style' );
1586
1587 $this->start_controls_tab(
1588 'toggle_style_normal',
1589 [
1590 'label' => __( 'Normal', 'easy-elements' ),
1591 ]
1592 );
1593
1594 $this->add_control(
1595 'toggle_color',
1596 [
1597 'label' => __( 'Color', 'easy-elements' ),
1598 'type' => Controls_Manager::COLOR,
1599 'selectors' => [
1600 '{{WRAPPER}} div.eel-nav-menu-icon' => 'color: {{VALUE}}',
1601 '{{WRAPPER}} div.eel-nav-menu-icon svg' => 'fill: {{VALUE}}',
1602 ],
1603 ]
1604 );
1605
1606 $this->add_control(
1607 'toggle_background_color',
1608 [
1609 'label' => __( 'Background Color', 'easy-elements' ),
1610 'type' => Controls_Manager::COLOR,
1611 'selectors' => [
1612 '{{WRAPPER}} .eel-nav-menu-icon' => 'background-color: {{VALUE}}; padding: 0.35em;',
1613 ],
1614 ]
1615 );
1616
1617 $this->end_controls_tab();
1618
1619 $this->start_controls_tab(
1620 'toggle_hover',
1621 [
1622 'label' => __( 'Hover', 'easy-elements' ),
1623 ]
1624 );
1625
1626 $this->add_control(
1627 'toggle_hover_color',
1628 [
1629 'label' => __( 'Color', 'easy-elements' ),
1630 'type' => Controls_Manager::COLOR,
1631 'selectors' => [
1632 '{{WRAPPER}} div.eel-nav-menu-icon:hover' => 'color: {{VALUE}}',
1633 '{{WRAPPER}} div.eel-nav-menu-icon:hover svg' => 'fill: {{VALUE}}',
1634
1635 ],
1636 ]
1637 );
1638
1639 $this->add_control(
1640 'toggle_hover_background_color',
1641 [
1642 'label' => __( 'Background Color', 'easy-elements' ),
1643 'type' => Controls_Manager::COLOR,
1644 'selectors' => [
1645 '{{WRAPPER}} .eel-nav-menu-icon:hover' => 'background-color: {{VALUE}}; padding: 0.35em;',
1646 ],
1647 ]
1648 );
1649
1650 $this->end_controls_tab();
1651
1652 $this->end_controls_tabs();
1653
1654 $this->add_responsive_control(
1655 'toggle_size',
1656 [
1657 'label' => __( 'Icon Size', 'easy-elements' ),
1658 'type' => Controls_Manager::SLIDER,
1659 'range' => [
1660 'px' => [
1661 'min' => 15,
1662 ],
1663 ],
1664 'selectors' => [
1665 '{{WRAPPER}} .eel-nav-menu-icon' => 'font-size: {{SIZE}}{{UNIT}}',
1666 '{{WRAPPER}} .eel-nav-menu-icon svg' => 'font-size: {{SIZE}}px;line-height: {{SIZE}}px;height: {{SIZE}}px;width: {{SIZE}}px;',
1667 ],
1668 'frontend_available' => true,
1669 'separator' => 'before',
1670 ]
1671 );
1672
1673 $this->add_responsive_control(
1674 'toggle_border_width',
1675 [
1676 'label' => __( 'Border Width', 'easy-elements' ),
1677 'type' => Controls_Manager::SLIDER,
1678 'range' => [
1679 'px' => [
1680 'max' => 10,
1681 ],
1682 ],
1683 'selectors' => [
1684 '{{WRAPPER}} .eel-nav-menu-icon' => 'border-width: {{SIZE}}{{UNIT}}; padding: 0.35em;',
1685 ],
1686 'frontend_available' => true,
1687 ]
1688 );
1689
1690 $this->add_responsive_control(
1691 'toggle_border_radius',
1692 [
1693 'label' => __( 'Border Radius', 'easy-elements' ),
1694 'type' => Controls_Manager::SLIDER,
1695 'size_units' => [ 'px', '%' ],
1696 'selectors' => [
1697 '{{WRAPPER}} .eel-nav-menu-icon' => 'border-radius: {{SIZE}}{{UNIT}}',
1698 ],
1699 'frontend_available' => true,
1700 ]
1701 );
1702
1703 $this->end_controls_section();
1704
1705 $this->start_controls_section(
1706 'style_toggle_close',
1707 [
1708 'label' => __( 'Menu Close', 'easy-elements' ),
1709 'tab' => Controls_Manager::TAB_STYLE,
1710 ]
1711 );
1712
1713 $this->add_control(
1714 'toggle_color_close',
1715 [
1716 'label' => __( 'Color', 'easy-elements' ),
1717 'type' => Controls_Manager::COLOR,
1718 'selectors' => [
1719 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon' => 'color: {{VALUE}}',
1720 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon svg' => 'fill: {{VALUE}}',
1721 ],
1722 ]
1723 );
1724
1725 $this->add_control(
1726 'toggle_background_color_close',
1727 [
1728 'label' => __( 'Background Color', 'easy-elements' ),
1729 'type' => Controls_Manager::COLOR,
1730 'selectors' => [
1731 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon' => 'background-color: {{VALUE}}; padding: 0.35em;',
1732 ],
1733 ]
1734 );
1735
1736 $this->add_group_control(
1737 \Elementor\Group_Control_Border::get_type(),
1738 [
1739 'name' => 'toggle_border_close',
1740 'label' => __( 'Border', 'easy-elements' ),
1741 'selector' => '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon',
1742 ]
1743 );
1744
1745 $this->add_responsive_control(
1746 'toggle_size_close',
1747 [
1748 'label' => __( 'Icon Size', 'easy-elements' ),
1749 'type' => Controls_Manager::SLIDER,
1750 'range' => [
1751 'px' => [
1752 'min' => 15,
1753 ],
1754 ],
1755 'selectors' => [
1756 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon' => 'font-size: {{SIZE}}{{UNIT}}',
1757 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon svg' => 'font-size: {{SIZE}}px;line-height: {{SIZE}}px;height: {{SIZE}}px;width: {{SIZE}}px;',
1758 ],
1759 'frontend_available' => true,
1760 'separator' => 'before',
1761 ]
1762 );
1763
1764 $this->add_responsive_control(
1765 'toggle_border_radius_close',
1766 [
1767 'label' => __( 'Border Radius', 'easy-elements' ),
1768 'type' => Controls_Manager::SLIDER,
1769 'size_units' => [ 'px', '%' ],
1770 'selectors' => [
1771 '.sidebar-on-mobile[data-nav-id="{{ID}}"] .eel-nav-menu-icon' => 'border-radius: {{SIZE}}{{UNIT}}',
1772 ],
1773 'frontend_available' => true,
1774 ]
1775 );
1776
1777 $this->end_controls_section();
1778 }
1779
1780 /**
1781 * Add itemprop for Navigation Schema.
1782 *
1783 * @since 1.5.2
1784 * @param string $atts link attributes.
1785 * @access public
1786 * @return string
1787 */
1788 public function handle_link_attrs( $atts ) {
1789
1790 $atts .= ' itemprop="url"';
1791 return $atts;
1792 }
1793
1794 /**
1795 * Add itemprop to the li tag of Navigation Schema.
1796 *
1797 * @since 1.6.0
1798 * @param string $value link attributes.
1799 * @access public
1800 * @return string
1801 */
1802 public function handle_li_values( $value ) {
1803
1804 $value .= ' itemprop="name"';
1805 return $value;
1806 }
1807
1808
1809 /**
1810 * Get the menu and close icon HTML.
1811 *
1812 * @since 1.5.2
1813 * @param array $settings Widget settings array.
1814 * @access public
1815 * @return array
1816 */
1817 public function get_menu_close_icon( $settings ) {
1818 $menu_icon = '';
1819 $close_icon = '';
1820 $icons = [];
1821 $icon_settings = [
1822 $settings['dropdown_icon'],
1823 //$settings['dropdown_close_icon'],
1824 ];
1825
1826 foreach ( $icon_settings as $icon ) {
1827 if ( $this->is_elementor_updated() ) {
1828 ob_start();
1829 \Elementor\Icons_Manager::render_icon(
1830 $icon,
1831 [
1832 'aria-hidden' => 'true',
1833 'tabindex' => '0',
1834 ]
1835 );
1836 $menu_icon = ob_get_clean();
1837 } else {
1838 $menu_icon = '<i class="' . esc_attr( $icon ) . '" aria-hidden="true" tabindex="0"></i>';
1839 }
1840
1841 array_push( $icons, $menu_icon );
1842 }
1843
1844 return $icons;
1845 }
1846
1847 /**
1848 * Render Nav Menu output on the frontend.
1849 *
1850 * Written in PHP and used to generate the final HTML.
1851 *
1852 * @since 1.3.0
1853 * @access protected
1854 * @return (void | false)
1855 */
1856 protected function render() {
1857
1858 $menus = $this->get_available_menus();
1859
1860 if ( empty( $menus ) ) {
1861 return;
1862 }
1863
1864 $settings = $this->get_settings_for_display();
1865
1866 $menu_close_icons = [];
1867 $menu_close_icons = $this->get_menu_close_icon( $settings );
1868
1869 $enableSticky = isset($settings['enable_sticky_header']) && 'yes' === $settings['enable_sticky_header'];
1870 $enablePadding = isset($settings['disable_top_padding']) && 'yes' === $settings['disable_top_padding'];
1871
1872 if ( isset( $settings['enable_sticky_header'] ) && 'yes' === $settings['enable_sticky_header'] ) {
1873 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
1874 $GLOBALS['easyel_force_sticky_header'] = true; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
1875
1876 // The sticky-header logic now lives in the always-loaded custom.js
1877 // (handle: eel-custom-js). Localizing the settings here is what
1878 // switches it on — when sticky is off, eelStickyHeaderSettings is
1879 // absent and the script no-ops.
1880 wp_localize_script('eel-custom-js', 'eelStickyHeaderSettings', [
1881 'enableSticky' => $enableSticky,
1882 'enablePadding' => $enablePadding
1883 ]);
1884
1885 if ( 'yes' === $settings['fixed_top_sticky'] ) {
1886 $this->add_render_attribute( 'eel-main-menu', 'class', 'eel-fixed-top-sticky' );
1887
1888 $inline_js = "
1889 document.addEventListener('DOMContentLoaded', function() {
1890 var header = document.querySelector('header.easy-site-header');
1891 if (header) {
1892 header.classList.add('eel-fixed-top-sticky');
1893 }
1894 });
1895 ";
1896
1897 wp_add_inline_script( 'eel-custom-js', $inline_js );
1898 }
1899 }
1900
1901 $args = [
1902 'echo' => false,
1903 'menu' => $settings['menu'],
1904 'menu_class' => 'eel-nav-menu',
1905 'menu_id' => 'menu-' . $this->get_nav_menu_index() . '-' . $this->get_id(),
1906 'fallback_cb' => '__return_empty_string',
1907 'walker' => new \Easyel_Menu_Walker(),
1908 ];
1909
1910 $mobile_args = [
1911 'echo' => false,
1912 'menu' => $settings['menu'],
1913 'menu_class' => 'eel-nav-menu eel-nav-menu-mobile',
1914 'fallback_cb' => '__return_empty_string',
1915 'walker' => new \Easyel_Menu_Walker(),
1916 'is_mobile_menu' => true,
1917 ];
1918
1919 $this->add_render_attribute(
1920 'eel-main-menu',
1921 'class',
1922 [
1923 'eel-nav-menu',
1924 'eel-layout-' . $settings['layout'],
1925 ]
1926 );
1927
1928 $this->add_render_attribute( 'eel-main-menu', 'class', 'eel-nav-menu-layout' );
1929
1930 $this->add_render_attribute( 'eel-main-menu', 'class', $settings['layout'] );
1931
1932 $this->add_render_attribute( 'eel-main-menu', 'data-layout', $settings['layout'] );
1933
1934 $this->add_render_attribute(
1935 'eel-nav-menu',
1936 'class',
1937 [
1938 'eel-nav-menu__layout-' . $settings['layout'],
1939 ]
1940 );
1941
1942 $icon_alignment = $settings['icon_alignment_vertical'] ?? 'align_left';
1943 $this->add_render_attribute(
1944 'eel-main-menu',
1945 'class',
1946 'icon-' . $icon_alignment
1947 );
1948
1949 if ( 'vertical' === $settings['layout'] && !empty($settings['menu_icon_vertical']['value']) ) {
1950 $this->add_render_attribute('eel-nav-menu', 'data-vertical-icon', $settings['menu_icon_vertical']['value']);
1951 }
1952
1953 $animation_class = !empty($settings['submenu_animation']) ? $settings['submenu_animation'] : 'eel_animation_slide_down';
1954 if ( 'horizontal' === $settings['layout'] ) {
1955 $this->add_render_attribute('eel-nav-menu', 'class', $animation_class);
1956 }
1957 ?>
1958
1959 <div <?php $this->print_render_attribute_string( 'eel-main-menu' ); ?>>
1960 <?php if ( isset( $settings['layout'] ) && 'horizontal' === $settings['layout'] ) : ?>
1961 <div role="button" class="eel-nav-menu__toggle elementor-clickable">
1962 <span class="screen-reader-text"><?php esc_html_e( 'Menu', 'easy-elements' ); ?></span>
1963 <div class="eel-nav-menu-icon" data-nav-target="<?php echo esc_attr( $this->get_id() ); ?>">
1964 <?php
1965 if ( isset( $menu_close_icons[0] ) ) {
1966 $menu_close_icon = str_replace( 'tabindex="0"', '', $menu_close_icons[0] );
1967 $allowed_svg = [
1968 'svg' => [
1969 'class' => true,
1970 'xmlns' => true,
1971 'width' => true,
1972 'height' => true,
1973 'viewbox' => true,
1974 'aria-hidden' => true,
1975 'role' => true,
1976 'focusable' => true,
1977 ],
1978 'path' => [
1979 'd' => true,
1980 'fill' => true,
1981 ],
1982 'g' => [ 'fill' => true ],
1983 'title' => [],
1984 ];
1985 echo wp_kses( $menu_close_icon, $allowed_svg );
1986 }
1987 ?>
1988 </div>
1989 </div>
1990 <?php endif; ?>
1991
1992
1993 <?php
1994 $settings = $this->get_settings_for_display();
1995 $nav_widget_id = $this->get_id();
1996 if ( isset( $settings['layout'] ) && 'horizontal' === $settings['layout'] ) {
1997 $open_position = !empty( $settings['mobile_menu_open_position'] ) ? $settings['mobile_menu_open_position'] : 'right';
1998 ?>
1999 <nav class="sidebar-on-mobile eel-mobile-open-position-<?php echo esc_attr( $open_position ); ?>" data-nav-id="<?php echo esc_attr( $nav_widget_id ); ?>">
2000 <span class="eel-nav-menu-icon eel-mobile-menu-icon-<?php echo esc_attr( $open_position ); ?>">
2001 <?php
2002 if ( ! empty( $settings['mobile_close_icon']['value'] ) ) {
2003 \Elementor\Icons_Manager::render_icon( $settings['mobile_close_icon'], [ 'aria-hidden' => 'true' ] );
2004 } else { ?>
2005 <i class="unicon-close"></i>
2006 <?php }
2007 ?>
2008 </span>
2009 <?php echo wp_nav_menu( $mobile_args ); ?>
2010 </nav>
2011 <?php
2012 }
2013 ?>
2014
2015 <nav <?php $this->print_render_attribute_string( 'eel-nav-menu' ); ?>>
2016 <?php echo wp_nav_menu( $args ); ?>
2017 </nav>
2018 </div>
2019 <?php
2020 }
2021 }