| 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 int $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__( 'Navigation 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 |
|
| 238 |
|
| 239 |
$this->add_control( |
| 240 |
'menu_last_item', |
| 241 |
[ |
| 242 |
'label' => __( 'Last Menu Item', 'easy-elements' ), |
| 243 |
'type' => Controls_Manager::SELECT, |
| 244 |
'options' => [ |
| 245 |
'none' => __( 'Default', 'easy-elements' ), |
| 246 |
'cta' => __( 'Button', 'easy-elements' ), |
| 247 |
], |
| 248 |
'default' => 'none', |
| 249 |
'condition' => [ |
| 250 |
'layout!' => 'expandible', |
| 251 |
], |
| 252 |
] |
| 253 |
); |
| 254 |
|
| 255 |
$this->add_control( |
| 256 |
'schema_support', |
| 257 |
[ |
| 258 |
'label' => __( 'Enable Schema Support', 'easy-elements' ), |
| 259 |
'type' => Controls_Manager::SWITCHER, |
| 260 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 261 |
'label_off' => __( 'No', 'easy-elements' ), |
| 262 |
'return_value' => 'yes', |
| 263 |
'default' => 'no', |
| 264 |
'render_type' => 'template', |
| 265 |
'separator' => 'before', |
| 266 |
] |
| 267 |
); |
| 268 |
|
| 269 |
$this->add_control( |
| 270 |
'enable_sticky_header', |
| 271 |
[ |
| 272 |
'label' => __( 'Enable Sticky Header', 'easy-elements' ), |
| 273 |
'type' => Controls_Manager::SWITCHER, |
| 274 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 275 |
'label_off' => __( 'No', 'easy-elements' ), |
| 276 |
'frontend_available' => true, |
| 277 |
'default' => 'no', |
| 278 |
] |
| 279 |
); |
| 280 |
|
| 281 |
$this->add_control( |
| 282 |
'fixed_top_sticky', |
| 283 |
[ |
| 284 |
'label' => __( 'Fixed Top Sticky', 'easy-elements' ), |
| 285 |
'type' => Controls_Manager::SWITCHER, |
| 286 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 287 |
'label_off' => __( 'No', 'easy-elements' ), |
| 288 |
'frontend_available' => true, |
| 289 |
'default' => 'no', |
| 290 |
'condition' => [ |
| 291 |
'enable_sticky_header' => 'yes', |
| 292 |
], |
| 293 |
] |
| 294 |
); |
| 295 |
|
| 296 |
$this->add_control( |
| 297 |
'bg_color_sticky', |
| 298 |
[ |
| 299 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 300 |
'type' => Controls_Manager::COLOR, |
| 301 |
'default' => '', |
| 302 |
'selectors' => [ |
| 303 |
'header.eel-sticky-header-on.eel-up-scroll, header.eel-sticky-header-on.eel--fixed-top-sticky, header.eel-sticky-header-on.eel-up-scroll .eel-nav-menu__layout-horizontal .eel-nav-menu .sub-menu:not(.easyel--elementor-template-mega-menu)' => 'background-color: {{VALUE}} !important', |
| 304 |
], |
| 305 |
'condition' => [ |
| 306 |
'enable_sticky_header' => 'yes', |
| 307 |
], |
| 308 |
] |
| 309 |
); |
| 310 |
|
| 311 |
$this->add_control( |
| 312 |
'text_color_sticky', |
| 313 |
[ |
| 314 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 315 |
'type' => Controls_Manager::COLOR, |
| 316 |
'default' => '', |
| 317 |
'selectors' => [ |
| 318 |
'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', |
| 319 |
], |
| 320 |
'condition' => [ |
| 321 |
'enable_sticky_header' => 'yes', |
| 322 |
], |
| 323 |
] |
| 324 |
); |
| 325 |
$this->add_group_control( |
| 326 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 327 |
[ |
| 328 |
'name' => 'box_shadow', |
| 329 |
'selector' => 'body header.eel-sticky-header-on.eel-up-scroll, body header.eel-sticky-header-on.eel--fixed-top-sticky', |
| 330 |
'condition' => [ |
| 331 |
'enable_sticky_header' => 'yes', |
| 332 |
], |
| 333 |
] |
| 334 |
); |
| 335 |
|
| 336 |
$current_theme = wp_get_theme(); |
| 337 |
|
| 338 |
if ( 'Twenty Twenty-One' === $current_theme->get( 'Name' ) ) { |
| 339 |
$this->add_control( |
| 340 |
'hide_theme_icons', |
| 341 |
[ |
| 342 |
'label' => __( 'Hide + & - Sign', 'easy-elements' ), |
| 343 |
'type' => Controls_Manager::SWITCHER, |
| 344 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 345 |
'label_off' => __( 'No', 'easy-elements' ), |
| 346 |
'return_value' => 'yes', |
| 347 |
'default' => 'no', |
| 348 |
'prefix_class' => 'eel-nav-menu__theme-icon-', |
| 349 |
] |
| 350 |
); |
| 351 |
} |
| 352 |
|
| 353 |
$this->end_controls_section(); |
| 354 |
|
| 355 |
$this->start_controls_section( |
| 356 |
'section_layout', |
| 357 |
[ |
| 358 |
'label' => __( 'Layout Settings', 'easy-elements' ), |
| 359 |
] |
| 360 |
); |
| 361 |
|
| 362 |
$this->add_control( |
| 363 |
'layout', |
| 364 |
[ |
| 365 |
'label' => __( 'Layout', 'easy-elements' ), |
| 366 |
'type' => Controls_Manager::SELECT, |
| 367 |
'default' => 'horizontal', |
| 368 |
'options' => [ |
| 369 |
'horizontal' => __( 'Horizontal', 'easy-elements' ), |
| 370 |
'vertical' => __( 'Vertical', 'easy-elements' ), |
| 371 |
], |
| 372 |
] |
| 373 |
); |
| 374 |
|
| 375 |
$this->add_control( |
| 376 |
'navmenu_align', |
| 377 |
[ |
| 378 |
'label' => __( 'Alignment', 'easy-elements' ), |
| 379 |
'type' => Controls_Manager::CHOOSE, |
| 380 |
'options' => [ |
| 381 |
'left' => [ |
| 382 |
'title' => __( 'Left', 'easy-elements' ), |
| 383 |
'icon' => 'eicon-h-align-left', |
| 384 |
], |
| 385 |
'center' => [ |
| 386 |
'title' => __( 'Center', 'easy-elements' ), |
| 387 |
'icon' => 'eicon-h-align-center', |
| 388 |
], |
| 389 |
'right' => [ |
| 390 |
'title' => __( 'Right', 'easy-elements' ), |
| 391 |
'icon' => 'eicon-h-align-right', |
| 392 |
], |
| 393 |
'justify' => [ |
| 394 |
'title' => __( 'Justify', 'easy-elements' ), |
| 395 |
'icon' => 'eicon-h-align-stretch', |
| 396 |
], |
| 397 |
], |
| 398 |
'default' => 'left', |
| 399 |
'condition' => [ |
| 400 |
'layout' => [ 'horizontal' ], |
| 401 |
], |
| 402 |
'prefix_class' => 'eel-nav-menu__align-', |
| 403 |
] |
| 404 |
); |
| 405 |
|
| 406 |
$this->add_responsive_control( |
| 407 |
'navmenu_align_text', |
| 408 |
[ |
| 409 |
'label' => __( 'Menu Alignment', 'easy-elements' ), |
| 410 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 411 |
'options' => [ |
| 412 |
'left' => [ |
| 413 |
'title' => __( 'Left', 'easy-elements' ), |
| 414 |
'icon' => 'eicon-h-align-left', |
| 415 |
], |
| 416 |
'center' => [ |
| 417 |
'title' => __( 'Center', 'easy-elements' ), |
| 418 |
'icon' => 'eicon-h-align-center', |
| 419 |
], |
| 420 |
'right' => [ |
| 421 |
'title' => __( 'Right', 'easy-elements' ), |
| 422 |
'icon' => 'eicon-h-align-right', |
| 423 |
], |
| 424 |
'justify' => [ |
| 425 |
'title' => __( 'Justify', 'easy-elements' ), |
| 426 |
'icon' => 'eicon-h-align-stretch', |
| 427 |
], |
| 428 |
], |
| 429 |
'default' => '', |
| 430 |
'condition' => [ |
| 431 |
'layout' => [ 'vertical' ], |
| 432 |
], |
| 433 |
'selectors' => [ |
| 434 |
'{{WRAPPER}} .eel-nav-menu li.menu-item' => 'text-align: {{VALUE}};', |
| 435 |
'{{WRAPPER}} .eel-nav-menu li.menu-item a' => 'max-width: 100%; width: auto; display: inline-block;', |
| 436 |
], |
| 437 |
] |
| 438 |
); |
| 439 |
|
| 440 |
$this->add_control( |
| 441 |
'submenu_animation', |
| 442 |
[ |
| 443 |
'label' => __( 'Submenu Animation', 'easy-elements' ), |
| 444 |
'type' => Controls_Manager::SELECT, |
| 445 |
'default' => 'none', |
| 446 |
'options' => [ |
| 447 |
'none' => __( 'Default', 'easy-elements' ), |
| 448 |
'slide_up' => __( 'Slide Up', 'easy-elements' ), |
| 449 |
], |
| 450 |
'prefix_class' => 'eel-submenu-animation-', |
| 451 |
'condition' => [ |
| 452 |
'layout' => 'horizontal', |
| 453 |
], |
| 454 |
] |
| 455 |
); |
| 456 |
|
| 457 |
$this->add_control( |
| 458 |
'menu_icon_vertical', |
| 459 |
[ |
| 460 |
'label' => __('Icon', 'easy-elements'), |
| 461 |
'type' => Controls_Manager::ICONS, |
| 462 |
'condition' => [ |
| 463 |
'layout' => 'vertical', |
| 464 |
], |
| 465 |
] |
| 466 |
); |
| 467 |
|
| 468 |
$this->add_responsive_control( |
| 469 |
'icon_alignment_vertical', |
| 470 |
[ |
| 471 |
'label' => __( 'Alignment', 'easy-elements' ), |
| 472 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 473 |
'options' => [ |
| 474 |
'0' => [ |
| 475 |
'title' => __( 'Left', 'easy-elements' ), |
| 476 |
'icon' => 'eicon-h-align-left', |
| 477 |
], |
| 478 |
'2' => [ |
| 479 |
'title' => __( 'Right', 'easy-elements' ), |
| 480 |
'icon' => 'eicon-h-align-right', |
| 481 |
], |
| 482 |
], |
| 483 |
'default' => '2', |
| 484 |
'condition' => [ |
| 485 |
'layout' => 'vertical', |
| 486 |
], |
| 487 |
'selectors' => [ |
| 488 |
'{{WRAPPER}} .eel-layout-vertical .eel-nav-menu li>.eel-menu-item .eel-menu-dynamic-icon' => 'order: {{VALUE}};', |
| 489 |
], |
| 490 |
] |
| 491 |
); |
| 492 |
|
| 493 |
$this->add_responsive_control( |
| 494 |
'icon_margin_vertical', |
| 495 |
[ |
| 496 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 497 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 498 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 499 |
'selectors' => [ |
| 500 |
'{{WRAPPER}} .eel-layout-vertical .eel-nav-menu li>.eel-menu-item .eel-menu-dynamic-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 501 |
], |
| 502 |
] |
| 503 |
); |
| 504 |
|
| 505 |
$this->add_responsive_control( |
| 506 |
'icon_alignment_vertical_text', |
| 507 |
[ |
| 508 |
'label' => __( 'Text Alignment', 'easy-elements' ), |
| 509 |
'type' => \Elementor\Controls_Manager::HIDDEN, |
| 510 |
'default' => 'flex-start', |
| 511 |
'condition' => [ |
| 512 |
'layout' => 'vertical', |
| 513 |
'icon_alignment_vertical' => '0', |
| 514 |
], |
| 515 |
'selectors' => [ |
| 516 |
'{{WRAPPER}} .eel-layout-vertical .eel-nav-menu li > .eel-menu-item' => 'justify-content: {{VALUE}};', |
| 517 |
], |
| 518 |
] |
| 519 |
); |
| 520 |
|
| 521 |
$this->add_control( |
| 522 |
'heading_responsive', |
| 523 |
[ |
| 524 |
'type' => Controls_Manager::HEADING, |
| 525 |
'label' => __( 'Responsive', 'easy-elements' ), |
| 526 |
'separator' => 'before', |
| 527 |
'condition' => [ |
| 528 |
'layout' => [ 'horizontal', 'vertical' ], |
| 529 |
], |
| 530 |
] |
| 531 |
); |
| 532 |
|
| 533 |
$this->add_control( |
| 534 |
'dropdown', |
| 535 |
[ |
| 536 |
'label' => __( 'Breakpoint', 'easy-elements' ), |
| 537 |
'type' => Controls_Manager::SELECT, |
| 538 |
'default' => 'tablet', |
| 539 |
'options' => [ |
| 540 |
'tablet' => __( 'Tablet (1025px >)', 'easy-elements' ), |
| 541 |
'none' => __( 'None', 'easy-elements' ), |
| 542 |
], |
| 543 |
'prefix_class' => 'eel-nav-menu__breakpoint-', |
| 544 |
'condition' => [ |
| 545 |
'layout' => [ 'horizontal', 'vertical' ], |
| 546 |
], |
| 547 |
'render_type' => 'template', |
| 548 |
] |
| 549 |
); |
| 550 |
|
| 551 |
|
| 552 |
$this->add_control( |
| 553 |
'show_mobile_on_sidebar', |
| 554 |
[ |
| 555 |
'label' => __( 'Show Mobile Menu On Sidebar', 'easy-elements' ), |
| 556 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 557 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 558 |
'label_off' => __( 'No', 'easy-elements' ), |
| 559 |
'default' => '', |
| 560 |
] |
| 561 |
); |
| 562 |
|
| 563 |
|
| 564 |
$this->start_controls_tabs( 'tabs_menu_item_style_mobile' ); |
| 565 |
|
| 566 |
$this->start_controls_tab( |
| 567 |
'tab_menu_item_normal_m', |
| 568 |
[ |
| 569 |
'label' => __( 'Normal', 'easy-elements' ), |
| 570 |
] |
| 571 |
); |
| 572 |
|
| 573 |
$this->add_control( |
| 574 |
'color_menu_item_m', |
| 575 |
[ |
| 576 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 577 |
'type' => Controls_Manager::COLOR, |
| 578 |
'selectors' => [ |
| 579 |
'{{WRAPPER}} .eel-mobile .menu-item a.eel-menu-item, .sidebar-on-mobile li.menu-item a, {{WRAPPER}} .eel-mobile .sub-menu a.eel-sub-menu-item' => 'color: {{VALUE}} !important;', |
| 580 |
], |
| 581 |
] |
| 582 |
); |
| 583 |
$this->add_group_control( |
| 584 |
\Elementor\Group_Control_Typography::get_type(), |
| 585 |
[ |
| 586 |
'name' => 'color_menu_item_m_typography', |
| 587 |
'label' => esc_html__('Typography', 'easy-elements' ), |
| 588 |
'selector' => '{{WRAPPER}} body .eel-mobile .menu-item a.eel-menu-item, body .sidebar-on-mobile li.menu-item a', |
| 589 |
] |
| 590 |
); |
| 591 |
|
| 592 |
$this->end_controls_tab(); |
| 593 |
|
| 594 |
$this->start_controls_tab( |
| 595 |
'tab_menu_item_hover_m', |
| 596 |
[ |
| 597 |
'label' => __( 'Hover', 'easy-elements' ), |
| 598 |
] |
| 599 |
); |
| 600 |
|
| 601 |
$this->add_control( |
| 602 |
'color_menu_item_hover_m', |
| 603 |
[ |
| 604 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 605 |
'type' => Controls_Manager::COLOR, |
| 606 |
'selectors' => [ |
| 607 |
'{{WRAPPER}} .eel-mobile .menu-item > a.eel-menu-item:hover, .sidebar-on-mobile li.menu-item > a:hover, |
| 608 |
{{WRAPPER}} .eel-mobile .sub-menu a.eel-sub-menu-item:hover, |
| 609 |
{{WRAPPER}} .eel-mobile .menu-item.current-menu-item > a.eel-menu-item, |
| 610 |
{{WRAPPER}} .eel-mobile .menu-item a.eel-menu-item.highlighted' => 'color: {{VALUE}} !important;', |
| 611 |
], |
| 612 |
] |
| 613 |
); |
| 614 |
|
| 615 |
$this->end_controls_tab(); |
| 616 |
|
| 617 |
$this->start_controls_tab( |
| 618 |
'tab_menu_item_active_m', |
| 619 |
[ |
| 620 |
'label' => __( 'Active', 'easy-elements' ), |
| 621 |
] |
| 622 |
); |
| 623 |
|
| 624 |
$this->add_control( |
| 625 |
'color_menu_item_active_m', |
| 626 |
[ |
| 627 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 628 |
'type' => Controls_Manager::COLOR, |
| 629 |
'selectors' => [ |
| 630 |
'{{WRAPPER}} .eel-mobile .menu-item.current-menu-item > a.eel-menu-item, |
| 631 |
.sidebar-on-mobile li.menu-item.current-menu-item > a, .sidebar-on-mobile li.menu-item a.eel-active, |
| 632 |
{{WRAPPER}} .eel-mobile .menu-item.current-menu-ancestor > a.eel-menu-item' => 'color: {{VALUE}} !important;', |
| 633 |
], |
| 634 |
] |
| 635 |
); |
| 636 |
|
| 637 |
|
| 638 |
$this->end_controls_tab(); |
| 639 |
|
| 640 |
$this->end_controls_tabs(); |
| 641 |
|
| 642 |
$this->add_control( |
| 643 |
'resp_align', |
| 644 |
[ |
| 645 |
'label' => __( 'Alignment', 'easy-elements' ), |
| 646 |
'type' => Controls_Manager::CHOOSE, |
| 647 |
'options' => [ |
| 648 |
'left' => [ |
| 649 |
'title' => __( 'Left', 'easy-elements' ), |
| 650 |
'icon' => 'eicon-h-align-left', |
| 651 |
], |
| 652 |
'center' => [ |
| 653 |
'title' => __( 'Center', 'easy-elements' ), |
| 654 |
'icon' => 'eicon-h-align-center', |
| 655 |
], |
| 656 |
'right' => [ |
| 657 |
'title' => __( 'Right', 'easy-elements' ), |
| 658 |
'icon' => 'eicon-h-align-right', |
| 659 |
], |
| 660 |
], |
| 661 |
'default' => 'center', |
| 662 |
'description' => __( 'This is the alignement of menu icon on selected responsive breakpoints.', 'easy-elements' ), |
| 663 |
'condition' => [ |
| 664 |
'layout' => [ 'horizontal', 'vertical' ], |
| 665 |
'dropdown!' => 'none', |
| 666 |
], |
| 667 |
'selectors_dictionary' => [ |
| 668 |
'left' => 'margin-right: auto', |
| 669 |
'center' => 'margin: 0 auto', |
| 670 |
'right' => 'margin-left: auto', |
| 671 |
], |
| 672 |
'selectors' => [ |
| 673 |
'{{WRAPPER}} .eel-nav-menu__toggle' => '{{VALUE}}', |
| 674 |
], |
| 675 |
] |
| 676 |
); |
| 677 |
|
| 678 |
$this->add_control( |
| 679 |
'full_width_dropdown', |
| 680 |
[ |
| 681 |
'label' => __( 'Full Width', 'easy-elements' ), |
| 682 |
'description' => __( 'Enable this option to stretch the Sub Menu to Full Width.', 'easy-elements' ), |
| 683 |
'type' => Controls_Manager::SWITCHER, |
| 684 |
'label_on' => __( 'Yes', 'easy-elements' ), |
| 685 |
'label_off' => __( 'No', 'easy-elements' ), |
| 686 |
'return_value' => 'yes', |
| 687 |
'default' => 'yes', |
| 688 |
'condition' => [ |
| 689 |
'dropdown!' => 'none', |
| 690 |
], |
| 691 |
'render_type' => 'template', |
| 692 |
] |
| 693 |
); |
| 694 |
|
| 695 |
|
| 696 |
$this->add_control( |
| 697 |
'dropdown_icon', |
| 698 |
[ |
| 699 |
'label' => __( 'Menu Icon', 'easy-elements' ), |
| 700 |
'type' => Controls_Manager::ICONS, |
| 701 |
'label_block' => 'true', |
| 702 |
'default' => [ |
| 703 |
'value' => 'fas fa-align-justify', |
| 704 |
'library' => 'fa-solid', |
| 705 |
], |
| 706 |
'condition' => [ |
| 707 |
'dropdown!' => 'none', |
| 708 |
], |
| 709 |
] |
| 710 |
); |
| 711 |
|
| 712 |
$this->add_control( |
| 713 |
'dropdown_close_icon', |
| 714 |
[ |
| 715 |
'label' => __( 'Close Icon', 'easy-elements' ), |
| 716 |
'type' => Controls_Manager::ICONS, |
| 717 |
'label_block' => 'true', |
| 718 |
'default' => [ |
| 719 |
'value' => 'far fa-window-close', |
| 720 |
'library' => 'fa-regular', |
| 721 |
], |
| 722 |
'condition' => [ |
| 723 |
'dropdown!' => 'none', |
| 724 |
], |
| 725 |
'condition' => [ |
| 726 |
'show_mobile_on_sidebar!' => 'yes', |
| 727 |
], |
| 728 |
] |
| 729 |
); |
| 730 |
|
| 731 |
$this->end_controls_section(); |
| 732 |
} |
| 733 |
|
| 734 |
/** |
| 735 |
* Register Nav Menu General Controls. |
| 736 |
* |
| 737 |
* @since 1.3.0 |
| 738 |
* @access protected |
| 739 |
* @return void |
| 740 |
*/ |
| 741 |
protected function register_style_content_controls() { |
| 742 |
|
| 743 |
$this->start_controls_section( |
| 744 |
'section_style_main-menu', |
| 745 |
[ |
| 746 |
'label' => __( 'Main Menu', 'easy-elements' ), |
| 747 |
'tab' => Controls_Manager::TAB_STYLE, |
| 748 |
'condition' => [ |
| 749 |
'layout!' => 'expandible', |
| 750 |
], |
| 751 |
] |
| 752 |
); |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
$this->add_responsive_control( |
| 757 |
'padding_horizontal_menu_item', |
| 758 |
[ |
| 759 |
'label' => __( 'Horizontal Padding', 'easy-elements' ), |
| 760 |
'type' => Controls_Manager::SLIDER, |
| 761 |
'size_units' => [ 'px' ], |
| 762 |
'range' => [ |
| 763 |
'px' => [ |
| 764 |
'max' => 50, |
| 765 |
], |
| 766 |
], |
| 767 |
'default' => [ |
| 768 |
'size' => 15, |
| 769 |
'unit' => 'px', |
| 770 |
], |
| 771 |
'selectors' => [ |
| 772 |
'{{WRAPPER}} .menu-item a.eel-menu-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}', |
| 773 |
'{{WRAPPER}} .menu-item a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 20px );padding-right: {{SIZE}}{{UNIT}};', |
| 774 |
'{{WRAPPER}} .eel-nav-menu__layout-vertical .menu-item ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 40px );padding-right: {{SIZE}}{{UNIT}};', |
| 775 |
'{{WRAPPER}} .eel-nav-menu__layout-vertical .menu-item ul ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 60px );padding-right: {{SIZE}}{{UNIT}};', |
| 776 |
'{{WRAPPER}} .eel-nav-menu__layout-vertical .menu-item ul ul ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 80px );padding-right: {{SIZE}}{{UNIT}};', |
| 777 |
], |
| 778 |
'frontend_available' => true, |
| 779 |
] |
| 780 |
); |
| 781 |
|
| 782 |
$this->add_responsive_control( |
| 783 |
'padding_vertical_menu_item', |
| 784 |
[ |
| 785 |
'label' => __( 'Vertical Padding', 'easy-elements' ), |
| 786 |
'type' => Controls_Manager::SLIDER, |
| 787 |
'size_units' => [ 'px' ], |
| 788 |
'range' => [ |
| 789 |
'px' => [ |
| 790 |
'max' => 50, |
| 791 |
], |
| 792 |
], |
| 793 |
'default' => [ |
| 794 |
'size' => 15, |
| 795 |
'unit' => 'px', |
| 796 |
], |
| 797 |
'selectors' => [ |
| 798 |
'{{WRAPPER}} .menu-item a.eel-menu-item, {{WRAPPER}} .menu-item a.eel-sub-menu-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 799 |
], |
| 800 |
'frontend_available' => true, |
| 801 |
] |
| 802 |
); |
| 803 |
|
| 804 |
$this->add_responsive_control( |
| 805 |
'menu_space_between', |
| 806 |
[ |
| 807 |
'label' => __( 'Space Between', 'easy-elements' ), |
| 808 |
'type' => Controls_Manager::SLIDER, |
| 809 |
'size_units' => [ 'px' ], |
| 810 |
'range' => [ |
| 811 |
'px' => [ |
| 812 |
'max' => 100, |
| 813 |
], |
| 814 |
], |
| 815 |
'selectors' => [ |
| 816 |
'body:not(.rtl) {{WRAPPER}} .eel-nav-menu__layout-horizontal .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}', |
| 817 |
'body.rtl {{WRAPPER}} .eel-nav-menu__layout-horizontal .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-left: {{SIZE}}{{UNIT}}', |
| 818 |
'{{WRAPPER}} nav:not(.eel-nav-menu__layout-horizontal) .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 819 |
'(tablet)body:not(.rtl) {{WRAPPER}}.eel-nav-menu__breakpoint-tablet .eel-nav-menu__layout-horizontal .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: 0px', |
| 820 |
'(mobile)body:not(.rtl) {{WRAPPER}}.eel-nav-menu__breakpoint-mobile .eel-nav-menu__layout-horizontal .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: 0px', |
| 821 |
'(tablet)body {{WRAPPER}} nav.eel-nav-menu__layout-vertical .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: 0px', |
| 822 |
'(mobile)body {{WRAPPER}} nav.eel-nav-menu__layout-vertical .eel-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: 0px', |
| 823 |
], |
| 824 |
'condition' => [ |
| 825 |
'layout!' => 'expandible', |
| 826 |
], |
| 827 |
'frontend_available' => true, |
| 828 |
] |
| 829 |
); |
| 830 |
|
| 831 |
$this->add_responsive_control( |
| 832 |
'border_radius', |
| 833 |
[ |
| 834 |
'label' => esc_html__('Border Radius', 'easy-elements'), |
| 835 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 836 |
'size_units' => [ 'px', 'em', '%' ], |
| 837 |
'selectors' => [ |
| 838 |
'{{WRAPPER}} .eel-nav-menu li > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu li, {{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 839 |
], |
| 840 |
'condition' => [ |
| 841 |
'layout' => 'vertical', |
| 842 |
], |
| 843 |
'frontend_available' => true, |
| 844 |
] |
| 845 |
); |
| 846 |
|
| 847 |
$this->add_responsive_control( |
| 848 |
'item_width_vertical', |
| 849 |
[ |
| 850 |
'label' => __('Width', 'easy-elements'), |
| 851 |
'type' => \Elementor\Controls_Manager::SLIDER, |
| 852 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 853 |
'range' => [ |
| 854 |
'%' => [ |
| 855 |
'min' => 1, |
| 856 |
'max' => 100, |
| 857 |
], |
| 858 |
'px' => [ |
| 859 |
'min' => 1, |
| 860 |
'max' => 600, |
| 861 |
], |
| 862 |
], |
| 863 |
'selectors' => [ |
| 864 |
'{{WRAPPER}} .eel-nav-menu li > a.eel-menu-item, {{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item' => 'width: {{SIZE}}{{UNIT}};', |
| 865 |
], |
| 866 |
'condition' => [ |
| 867 |
'layout' => 'vertical', |
| 868 |
], |
| 869 |
] |
| 870 |
); |
| 871 |
|
| 872 |
$this->add_responsive_control( |
| 873 |
'menu_row_space', |
| 874 |
[ |
| 875 |
'label' => __( 'Row Spacing', 'easy-elements' ), |
| 876 |
'type' => Controls_Manager::SLIDER, |
| 877 |
'size_units' => [ 'px' ], |
| 878 |
'range' => [ |
| 879 |
'px' => [ |
| 880 |
'max' => 100, |
| 881 |
], |
| 882 |
], |
| 883 |
'selectors' => [ |
| 884 |
'body:not(.rtl) {{WRAPPER}} .eel-nav-menu__layout-horizontal .eel-nav-menu > li.menu-item' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 885 |
], |
| 886 |
'condition' => [ |
| 887 |
'layout' => 'horizontal', |
| 888 |
], |
| 889 |
'frontend_available' => true, |
| 890 |
] |
| 891 |
); |
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
$this->add_control( |
| 896 |
'pointer', |
| 897 |
[ |
| 898 |
'label' => __( 'Link Hover Effect', 'easy-elements' ), |
| 899 |
'type' => Controls_Manager::SELECT, |
| 900 |
'default' => 'none', |
| 901 |
'options' => [ |
| 902 |
'none' => __( 'None', 'easy-elements' ), |
| 903 |
'underline' => __( 'Underline', 'easy-elements' ), |
| 904 |
'overline' => __( 'Overline', 'easy-elements' ), |
| 905 |
'double-line' => __( 'Double Line', 'easy-elements' ), |
| 906 |
'framed' => __( 'Framed', 'easy-elements' ), |
| 907 |
'text' => __( 'Text', 'easy-elements' ), |
| 908 |
], |
| 909 |
'condition' => [ |
| 910 |
'layout' => [ 'horizontal' ], |
| 911 |
], |
| 912 |
] |
| 913 |
); |
| 914 |
|
| 915 |
$this->add_control( |
| 916 |
'pointer_line_height', |
| 917 |
[ |
| 918 |
'label' => __( 'Line Height', 'easy-elements' ), |
| 919 |
'type' => Controls_Manager::SLIDER, |
| 920 |
'size_units' => [ 'px' ], |
| 921 |
'range' => [ |
| 922 |
'px' => [ |
| 923 |
'min' => 1, |
| 924 |
'max' => 20, |
| 925 |
], |
| 926 |
], |
| 927 |
'default' => [ |
| 928 |
'size' => 1, |
| 929 |
'unit' => 'px', |
| 930 |
], |
| 931 |
'selectors' => [ |
| 932 |
'{{WRAPPER}} .eel-pointer__double-line .menu-item.parent a.eel-menu-item:before, |
| 933 |
{{WRAPPER}} .eel-pointer__double-line .menu-item.parent a.eel-menu-item:after, |
| 934 |
{{WRAPPER}} .eel-pointer__underline .menu-item.parent a.eel-menu-item:before, |
| 935 |
{{WRAPPER}} .eel-pointer__underline .menu-item.parent a.eel-menu-item:after, |
| 936 |
{{WRAPPER}} .eel-pointer__overline .menu-item.parent a.eel-menu-item:before, |
| 937 |
{{WRAPPER}} .eel-pointer__overline .menu-item.parent a.eel-menu-item:after' => 'height: {{SIZE}}{{UNIT}};', |
| 938 |
], |
| 939 |
'condition' => [ |
| 940 |
'layout' => [ 'horizontal' ], |
| 941 |
'pointer' => [ 'underline', 'overline', 'double-line' ], |
| 942 |
], |
| 943 |
] |
| 944 |
); |
| 945 |
|
| 946 |
$this->add_control( |
| 947 |
'animation_line', |
| 948 |
[ |
| 949 |
'label' => __( 'Animation', 'easy-elements' ), |
| 950 |
'type' => Controls_Manager::SELECT, |
| 951 |
'default' => 'fade', |
| 952 |
'options' => [ |
| 953 |
'fade' => 'Fade', |
| 954 |
'slide' => 'Slide', |
| 955 |
'grow' => 'Grow', |
| 956 |
'drop-in' => 'Drop In', |
| 957 |
'drop-out' => 'Drop Out', |
| 958 |
'none' => 'None', |
| 959 |
], |
| 960 |
'condition' => [ |
| 961 |
'layout' => [ 'horizontal' ], |
| 962 |
'pointer' => [ 'underline', 'overline', 'double-line' ], |
| 963 |
], |
| 964 |
] |
| 965 |
); |
| 966 |
|
| 967 |
$this->add_control( |
| 968 |
'animation_framed', |
| 969 |
[ |
| 970 |
'label' => __( 'Frame Animation', 'easy-elements' ), |
| 971 |
'type' => Controls_Manager::SELECT, |
| 972 |
'default' => 'fade', |
| 973 |
'options' => [ |
| 974 |
'fade' => 'Fade', |
| 975 |
'grow' => 'Grow', |
| 976 |
'shrink' => 'Shrink', |
| 977 |
'draw' => 'Draw', |
| 978 |
'corners' => 'Corners', |
| 979 |
'none' => 'None', |
| 980 |
], |
| 981 |
'condition' => [ |
| 982 |
'layout' => [ 'horizontal' ], |
| 983 |
'pointer' => 'framed', |
| 984 |
], |
| 985 |
] |
| 986 |
); |
| 987 |
|
| 988 |
$this->add_control( |
| 989 |
'animation_text', |
| 990 |
[ |
| 991 |
'label' => __( 'Animation', 'easy-elements' ), |
| 992 |
'type' => Controls_Manager::SELECT, |
| 993 |
'default' => 'grow', |
| 994 |
'options' => [ |
| 995 |
'grow' => 'Grow', |
| 996 |
'shrink' => 'Shrink', |
| 997 |
'sink' => 'Sink', |
| 998 |
'float' => 'Float', |
| 999 |
'skew' => 'Skew', |
| 1000 |
'rotate' => 'Rotate', |
| 1001 |
'none' => 'None', |
| 1002 |
], |
| 1003 |
'condition' => [ |
| 1004 |
'layout' => [ 'horizontal' ], |
| 1005 |
'pointer' => 'text', |
| 1006 |
], |
| 1007 |
] |
| 1008 |
); |
| 1009 |
|
| 1010 |
$this->add_control( |
| 1011 |
'style_divider', |
| 1012 |
[ |
| 1013 |
'type' => Controls_Manager::DIVIDER, |
| 1014 |
] |
| 1015 |
); |
| 1016 |
|
| 1017 |
$this->add_group_control( |
| 1018 |
Group_Control_Typography::get_type(), |
| 1019 |
[ |
| 1020 |
'name' => 'menu_typography', |
| 1021 |
'separator' => 'before', |
| 1022 |
'selector' => '{{WRAPPER}} a.eel-menu-item, {{WRAPPER}} a.eel-sub-menu-item', |
| 1023 |
] |
| 1024 |
); |
| 1025 |
|
| 1026 |
$this->start_controls_tabs( 'tabs_menu_item_style' ); |
| 1027 |
|
| 1028 |
$this->start_controls_tab( |
| 1029 |
'tab_menu_item_normal', |
| 1030 |
[ |
| 1031 |
'label' => __( 'Normal', 'easy-elements' ), |
| 1032 |
] |
| 1033 |
); |
| 1034 |
|
| 1035 |
$this->add_control( |
| 1036 |
'color_menu_item', |
| 1037 |
[ |
| 1038 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1039 |
'type' => Controls_Manager::COLOR, |
| 1040 |
'default' => '', |
| 1041 |
'selectors' => [ |
| 1042 |
'{{WRAPPER}} .menu-item a.eel-menu-item, {{WRAPPER}} .sub-menu a.eel-sub-menu-item' => 'color: {{VALUE}}', |
| 1043 |
], |
| 1044 |
] |
| 1045 |
); |
| 1046 |
|
| 1047 |
$this->add_control( |
| 1048 |
'bg_color_menu_item', |
| 1049 |
[ |
| 1050 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1051 |
'type' => Controls_Manager::COLOR, |
| 1052 |
'default' => '', |
| 1053 |
'selectors' => [ |
| 1054 |
'{{WRAPPER}} .menu-item a.eel-menu-item, {{WRAPPER}} .sub-menu, {{WRAPPER}} nav.eel-dropdown' => 'background-color: {{VALUE}}', |
| 1055 |
], |
| 1056 |
] |
| 1057 |
); |
| 1058 |
|
| 1059 |
$this->end_controls_tab(); |
| 1060 |
|
| 1061 |
$this->start_controls_tab( |
| 1062 |
'tab_menu_item_hover', |
| 1063 |
[ |
| 1064 |
'label' => __( 'Hover', 'easy-elements' ), |
| 1065 |
] |
| 1066 |
); |
| 1067 |
|
| 1068 |
$this->add_control( |
| 1069 |
'color_menu_item_hover', |
| 1070 |
[ |
| 1071 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1072 |
'type' => Controls_Manager::COLOR, |
| 1073 |
'selectors' => [ |
| 1074 |
'{{WRAPPER}} .menu-item a.eel-menu-item:hover, |
| 1075 |
{{WRAPPER}} .sub-menu a.eel-sub-menu-item:hover, |
| 1076 |
{{WRAPPER}} nav ul.eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, |
| 1077 |
{{WRAPPER}} .menu-item a.eel-menu-item.highlighted' => 'color: {{VALUE}}', |
| 1078 |
], |
| 1079 |
] |
| 1080 |
); |
| 1081 |
|
| 1082 |
$this->add_control( |
| 1083 |
'bg_color_menu_item_hover', |
| 1084 |
[ |
| 1085 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1086 |
'type' => Controls_Manager::COLOR, |
| 1087 |
'selectors' => [ |
| 1088 |
'{{WRAPPER}} .menu-item a.eel-menu-item:hover, |
| 1089 |
{{WRAPPER}} .sub-menu a.eel-sub-menu-item:hover, |
| 1090 |
{{WRAPPER}} nav ul.eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, |
| 1091 |
{{WRAPPER}} .menu-item a.eel-menu-item.highlighted' => 'background-color: {{VALUE}}', |
| 1092 |
], |
| 1093 |
] |
| 1094 |
); |
| 1095 |
|
| 1096 |
$this->add_control( |
| 1097 |
'pointer_color_menu_item_hover', |
| 1098 |
[ |
| 1099 |
'label' => __( 'Link Hover Effect Color', 'easy-elements' ), |
| 1100 |
'type' => Controls_Manager::COLOR, |
| 1101 |
'default' => '', |
| 1102 |
'selectors' => [ |
| 1103 |
'{{WRAPPER}} .eel-nav-menu-layout:not(.eel-pointer__framed) .menu-item.parent a.eel-menu-item:before, |
| 1104 |
{{WRAPPER}} .eel-nav-menu-layout:not(.eel-pointer__framed) .menu-item.parent a.eel-menu-item:after' => 'background-color: {{VALUE}}', |
| 1105 |
'{{WRAPPER}} .eel-nav-menu-layout:not(.eel-pointer__framed) .menu-item.parent .sub-menu .eel-has-submenu-container a:after' => 'background-color: unset', |
| 1106 |
'{{WRAPPER}} .eel-pointer__framed .menu-item.parent a.eel-menu-item:before, |
| 1107 |
{{WRAPPER}} .eel-pointer__framed .menu-item.parent a.eel-menu-item:after' => 'border-color: {{VALUE}}', |
| 1108 |
], |
| 1109 |
'condition' => [ |
| 1110 |
'pointer!' => [ 'none', 'text' ], |
| 1111 |
], |
| 1112 |
] |
| 1113 |
); |
| 1114 |
|
| 1115 |
$this->end_controls_tab(); |
| 1116 |
|
| 1117 |
$this->start_controls_tab( |
| 1118 |
'tab_menu_item_active', |
| 1119 |
[ |
| 1120 |
'label' => __( 'Active', 'easy-elements' ), |
| 1121 |
] |
| 1122 |
); |
| 1123 |
|
| 1124 |
$this->add_control( |
| 1125 |
'color_menu_item_active', |
| 1126 |
[ |
| 1127 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1128 |
'type' => Controls_Manager::COLOR, |
| 1129 |
'default' => '', |
| 1130 |
'selectors' => [ |
| 1131 |
'{{WRAPPER}} nav ul.eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, |
| 1132 |
{{WRAPPER}} nav ul.eel-nav-menu > .menu-item a.eel-menu-item.eel-active, |
| 1133 |
{{WRAPPER}} nav ul.eel-nav-menu > .menu-item.current-menu-ancestor > a.eel-menu-item' => 'color: {{VALUE}}', |
| 1134 |
], |
| 1135 |
] |
| 1136 |
); |
| 1137 |
|
| 1138 |
$this->add_control( |
| 1139 |
'bg_color_menu_item_active', |
| 1140 |
[ |
| 1141 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1142 |
'type' => Controls_Manager::COLOR, |
| 1143 |
'default' => '', |
| 1144 |
'selectors' => [ |
| 1145 |
'{{WRAPPER}} nav ul.eel-nav-menu > .menu-item.current-menu-item > a.eel-menu-item, |
| 1146 |
{{WRAPPER}} .menu-item.current-menu-ancestor a.eel-menu-item' => 'background-color: {{VALUE}}', |
| 1147 |
], |
| 1148 |
] |
| 1149 |
); |
| 1150 |
|
| 1151 |
$this->add_control( |
| 1152 |
'pointer_color_menu_item_active', |
| 1153 |
[ |
| 1154 |
'label' => __( 'Link Hover Effect Color', 'easy-elements' ), |
| 1155 |
'type' => Controls_Manager::COLOR, |
| 1156 |
'default' => '', |
| 1157 |
'selectors' => [ |
| 1158 |
'{{WRAPPER}} .eel-nav-menu-layout:not(.eel-pointer__framed) .menu-item.parent.current-menu-item a.eel-menu-item:before, |
| 1159 |
{{WRAPPER}} .eel-nav-menu-layout:not(.eel-pointer__framed) .menu-item.parent.current-menu-item a.eel-menu-item:after' => 'background-color: {{VALUE}}', |
| 1160 |
'{{WRAPPER}} .eel-nav-menu:not(.eel-pointer__framed) .menu-item.parent .sub-menu .eel-has-submenu-container a.current-menu-item:after' => 'background-color: unset', |
| 1161 |
'{{WRAPPER}} .eel-pointer__framed .menu-item.parent.current-menu-item a.eel-menu-item:before, |
| 1162 |
{{WRAPPER}} .eel-pointer__framed .menu-item.parent.current-menu-item a.eel-menu-item:after' => 'border-color: {{VALUE}}', |
| 1163 |
], |
| 1164 |
'condition' => [ |
| 1165 |
'pointer!' => [ 'none', 'text' ], |
| 1166 |
], |
| 1167 |
] |
| 1168 |
); |
| 1169 |
|
| 1170 |
$this->end_controls_tab(); |
| 1171 |
|
| 1172 |
$this->end_controls_tabs(); |
| 1173 |
|
| 1174 |
$this->end_controls_section(); |
| 1175 |
} |
| 1176 |
|
| 1177 |
/** |
| 1178 |
* Register Nav Menu General Controls. |
| 1179 |
* |
| 1180 |
* @since 1.3.0 |
| 1181 |
* @access protected |
| 1182 |
* @return void |
| 1183 |
*/ |
| 1184 |
protected function register_dropdown_content_controls() { |
| 1185 |
|
| 1186 |
$this->start_controls_section( |
| 1187 |
'section_style_dropdown', |
| 1188 |
[ |
| 1189 |
'label' => __( 'Dropdown', 'easy-elements' ), |
| 1190 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1191 |
] |
| 1192 |
); |
| 1193 |
|
| 1194 |
$this->add_control( |
| 1195 |
'dropdown_description', |
| 1196 |
[ |
| 1197 |
'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' ), |
| 1198 |
'type' => Controls_Manager::RAW_HTML, |
| 1199 |
'content_classes' => 'elementor-descriptor', |
| 1200 |
'condition' => [ |
| 1201 |
'layout!' => [ |
| 1202 |
'expandible', |
| 1203 |
], |
| 1204 |
], |
| 1205 |
] |
| 1206 |
); |
| 1207 |
|
| 1208 |
$this->start_controls_tabs( 'tabs_dropdown_item_style' ); |
| 1209 |
|
| 1210 |
$this->start_controls_tab( |
| 1211 |
'tab_dropdown_item_normal', |
| 1212 |
[ |
| 1213 |
'label' => __( 'Normal', 'easy-elements' ), |
| 1214 |
] |
| 1215 |
); |
| 1216 |
|
| 1217 |
$this->add_control( |
| 1218 |
'color_dropdown_item', |
| 1219 |
[ |
| 1220 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1221 |
'type' => Controls_Manager::COLOR, |
| 1222 |
'default' => '', |
| 1223 |
'selectors' => [ |
| 1224 |
'{{WRAPPER}} .sub-menu a.eel-sub-menu-item, |
| 1225 |
{{WRAPPER}} .elementor-menu-toggle, |
| 1226 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item, |
| 1227 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item' => 'color: {{VALUE}}', |
| 1228 |
], |
| 1229 |
] |
| 1230 |
); |
| 1231 |
|
| 1232 |
$this->add_control( |
| 1233 |
'background_color_dropdown_item', |
| 1234 |
[ |
| 1235 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1236 |
'type' => Controls_Manager::COLOR, |
| 1237 |
'default' => '#fff', |
| 1238 |
'selectors' => [ |
| 1239 |
'{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu), |
| 1240 |
{{WRAPPER}} nav.eel-dropdown, |
| 1241 |
{{WRAPPER}} nav.eel-dropdown .menu-item a.eel-menu-item, |
| 1242 |
{{WRAPPER}} nav.eel-dropdown .menu-item a.eel-sub-menu-item' => 'background-color: {{VALUE}}', |
| 1243 |
], |
| 1244 |
'separator' => 'after', |
| 1245 |
] |
| 1246 |
); |
| 1247 |
|
| 1248 |
$this->end_controls_tab(); |
| 1249 |
|
| 1250 |
$this->start_controls_tab( |
| 1251 |
'tab_dropdown_item_hover', |
| 1252 |
[ |
| 1253 |
'label' => __( 'Hover', 'easy-elements' ), |
| 1254 |
] |
| 1255 |
); |
| 1256 |
|
| 1257 |
$this->add_control( |
| 1258 |
'color_dropdown_item_hover', |
| 1259 |
[ |
| 1260 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1261 |
'type' => Controls_Manager::COLOR, |
| 1262 |
'default' => '', |
| 1263 |
'selectors' => [ |
| 1264 |
'{{WRAPPER}} .sub-menu a.eel-sub-menu-item:hover, |
| 1265 |
{{WRAPPER}} .elementor-menu-toggle:hover, |
| 1266 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item:hover, |
| 1267 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item:hover' => 'color: {{VALUE}}', |
| 1268 |
], |
| 1269 |
] |
| 1270 |
); |
| 1271 |
|
| 1272 |
$this->add_control( |
| 1273 |
'background_color_dropdown_item_hover', |
| 1274 |
[ |
| 1275 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1276 |
'type' => Controls_Manager::COLOR, |
| 1277 |
'default' => '', |
| 1278 |
'selectors' => [ |
| 1279 |
'{{WRAPPER}} .sub-menu a.eel-sub-menu-item:hover, |
| 1280 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item:hover, |
| 1281 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item:hover' => 'background-color: {{VALUE}}', |
| 1282 |
], |
| 1283 |
'separator' => 'after', |
| 1284 |
] |
| 1285 |
); |
| 1286 |
|
| 1287 |
$this->end_controls_tab(); |
| 1288 |
|
| 1289 |
$this->start_controls_tab( |
| 1290 |
'tab_dropdown_item_active', |
| 1291 |
[ |
| 1292 |
'label' => __( 'Active', 'easy-elements' ), |
| 1293 |
] |
| 1294 |
); |
| 1295 |
|
| 1296 |
$this->add_control( |
| 1297 |
'color_dropdown_item_active', |
| 1298 |
[ |
| 1299 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1300 |
'type' => Controls_Manager::COLOR, |
| 1301 |
'default' => '', |
| 1302 |
'selectors' => [ |
| 1303 |
'{{WRAPPER}} .sub-menu .menu-item.current-menu-item a.eel-sub-menu-item.eel-sub-menu-item-active, |
| 1304 |
{{WRAPPER}} nav.eel-dropdown .menu-item.current-menu-item a.eel-menu-item, |
| 1305 |
{{WRAPPER}} nav.eel-dropdown .menu-item.current-menu-ancestor a.eel-menu-item, |
| 1306 |
{{WRAPPER}} nav.eel-dropdown .sub-menu .menu-item.current-menu-item a.eel-sub-menu-item.eel-sub-menu-item-active |
| 1307 |
' => 'color: {{VALUE}}', |
| 1308 |
|
| 1309 |
], |
| 1310 |
] |
| 1311 |
); |
| 1312 |
|
| 1313 |
$this->add_control( |
| 1314 |
'background_color_dropdown_item_active', |
| 1315 |
[ |
| 1316 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1317 |
'type' => Controls_Manager::COLOR, |
| 1318 |
'default' => '', |
| 1319 |
'selectors' => [ |
| 1320 |
'{{WRAPPER}} .sub-menu .menu-item.current-menu-item a.eel-sub-menu-item.eel-sub-menu-item-active, |
| 1321 |
{{WRAPPER}} nav.eel-dropdown .menu-item.current-menu-item a.eel-menu-item, |
| 1322 |
{{WRAPPER}} nav.eel-dropdown .menu-item.current-menu-ancestor a.eel-menu-item, |
| 1323 |
{{WRAPPER}} nav.eel-dropdown .sub-menu .menu-item.current-menu-item a.eel-sub-menu-item.eel-sub-menu-item-active' => 'background-color: {{VALUE}}', |
| 1324 |
], |
| 1325 |
'separator' => 'after', |
| 1326 |
|
| 1327 |
] |
| 1328 |
); |
| 1329 |
|
| 1330 |
$this->end_controls_tabs(); |
| 1331 |
|
| 1332 |
$this->end_controls_tabs(); |
| 1333 |
|
| 1334 |
$this->add_group_control( |
| 1335 |
Group_Control_Typography::get_type(), |
| 1336 |
[ |
| 1337 |
'name' => 'dropdown_typography', |
| 1338 |
'separator' => 'before', |
| 1339 |
'selector' => ' |
| 1340 |
{{WRAPPER}} .sub-menu li a.eel-sub-menu-item, |
| 1341 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item, |
| 1342 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item', |
| 1343 |
] |
| 1344 |
); |
| 1345 |
|
| 1346 |
$this->add_group_control( |
| 1347 |
Group_Control_Border::get_type(), |
| 1348 |
[ |
| 1349 |
'name' => 'dropdown_border', |
| 1350 |
'selector' => '{{WRAPPER}} nav.eel-nav-menu__layout-horizontal .sub-menu:not(.easyel--elementor-template-mega-menu), |
| 1351 |
{{WRAPPER}} nav:not(.eel-nav-menu__layout-horizontal) .sub-menu.sub-menu-open, |
| 1352 |
{{WRAPPER}} nav.eel-dropdown .eel-nav-menu, |
| 1353 |
{{WRAPPER}} nav.eel-dropdown .eel-nav-menu', |
| 1354 |
] |
| 1355 |
); |
| 1356 |
|
| 1357 |
$this->add_responsive_control( |
| 1358 |
'dropdown_border_radius', |
| 1359 |
[ |
| 1360 |
'label' => __( 'Border Radius', 'easy-elements' ), |
| 1361 |
'type' => Controls_Manager::DIMENSIONS, |
| 1362 |
'size_units' => [ 'px', '%' ], |
| 1363 |
'selectors' => [ |
| 1364 |
'{{WRAPPER}} .sub-menu:not(.easyel--elementor-template-mega-menu)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1365 |
'{{WRAPPER}} .sub-menu li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden;', |
| 1366 |
'{{WRAPPER}} .sub-menu li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', |
| 1367 |
'{{WRAPPER}} nav.eel-dropdown' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1368 |
'{{WRAPPER}} nav.eel-dropdown li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden', |
| 1369 |
'{{WRAPPER}} nav.eel-dropdown li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', |
| 1370 |
'{{WRAPPER}} nav.eel-dropdown' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1371 |
'{{WRAPPER}} nav.eel-dropdown li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden', |
| 1372 |
'{{WRAPPER}} nav.eel-dropdown li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', |
| 1373 |
], |
| 1374 |
'frontend_available' => true, |
| 1375 |
] |
| 1376 |
); |
| 1377 |
|
| 1378 |
$this->add_group_control( |
| 1379 |
Group_Control_Box_Shadow::get_type(), |
| 1380 |
[ |
| 1381 |
'name' => 'dropdown_box_shadow', |
| 1382 |
'selector' => '{{WRAPPER}} .eel-nav-menu .sub-menu:not(.easyel--elementor-template-mega-menu), |
| 1383 |
{{WRAPPER}} nav.eel-dropdown, |
| 1384 |
{{WRAPPER}} nav.eel-dropdown', |
| 1385 |
'separator' => 'after', |
| 1386 |
] |
| 1387 |
); |
| 1388 |
|
| 1389 |
$this->add_responsive_control( |
| 1390 |
'width_dropdown_item', |
| 1391 |
[ |
| 1392 |
'label' => __( 'Dropdown Width (px)', 'easy-elements' ), |
| 1393 |
'type' => Controls_Manager::SLIDER, |
| 1394 |
'range' => [ |
| 1395 |
'px' => [ |
| 1396 |
'min' => 0, |
| 1397 |
'max' => 500, |
| 1398 |
], |
| 1399 |
], |
| 1400 |
'default' => [ |
| 1401 |
'size' => '220', |
| 1402 |
'unit' => 'px', |
| 1403 |
], |
| 1404 |
'selectors' => [ |
| 1405 |
'{{WRAPPER}} ul.sub-menu:not(.easyel--elementor-template-mega-menu)' => 'width: {{SIZE}}{{UNIT}}', |
| 1406 |
], |
| 1407 |
'condition' => [ |
| 1408 |
'layout' => 'horizontal', |
| 1409 |
], |
| 1410 |
'frontend_available' => true, |
| 1411 |
] |
| 1412 |
); |
| 1413 |
|
| 1414 |
$this->add_responsive_control( |
| 1415 |
'padding_horizontal_dropdown_item', |
| 1416 |
[ |
| 1417 |
'label' => __( 'Horizontal Padding', 'easy-elements' ), |
| 1418 |
'type' => Controls_Manager::SLIDER, |
| 1419 |
'size_units' => [ 'px' ], |
| 1420 |
'selectors' => [ |
| 1421 |
'{{WRAPPER}} .sub-menu li a.eel-sub-menu-item, |
| 1422 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item, |
| 1423 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}', |
| 1424 |
'{{WRAPPER}} nav.eel-dropdown a.eel-sub-menu-item, |
| 1425 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 20px );padding-right: {{SIZE}}{{UNIT}};', |
| 1426 |
'{{WRAPPER}} .eel-dropdown .menu-item ul ul a.eel-sub-menu-item, |
| 1427 |
{{WRAPPER}} .eel-dropdown .menu-item ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 40px );padding-right: {{SIZE}}{{UNIT}};', |
| 1428 |
'{{WRAPPER}} .eel-dropdown .menu-item ul ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 60px );padding-right: {{SIZE}}{{UNIT}};', |
| 1429 |
'{{WRAPPER}} .eel-dropdown .menu-item ul ul ul ul a.eel-sub-menu-item, |
| 1430 |
{{WRAPPER}} .eel-dropdown .menu-item ul ul ul ul a.eel-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 80px );padding-right: {{SIZE}}{{UNIT}};', |
| 1431 |
], |
| 1432 |
'frontend_available' => true, |
| 1433 |
] |
| 1434 |
); |
| 1435 |
|
| 1436 |
$this->add_responsive_control( |
| 1437 |
'padding_vertical_dropdown_item', |
| 1438 |
[ |
| 1439 |
'label' => __( 'Vertical Padding', 'easy-elements' ), |
| 1440 |
'type' => Controls_Manager::SLIDER, |
| 1441 |
'size_units' => [ 'px' ], |
| 1442 |
'default' => [ |
| 1443 |
'size' => 15, |
| 1444 |
'unit' => 'px', |
| 1445 |
], |
| 1446 |
'range' => [ |
| 1447 |
'px' => [ |
| 1448 |
'max' => 50, |
| 1449 |
], |
| 1450 |
], |
| 1451 |
'selectors' => [ |
| 1452 |
'{{WRAPPER}} .sub-menu a.eel-sub-menu-item, |
| 1453 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item, |
| 1454 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item, |
| 1455 |
{{WRAPPER}} nav.eel-dropdown li a.eel-menu-item, |
| 1456 |
{{WRAPPER}} nav.eel-dropdown li a.eel-sub-menu-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}', |
| 1457 |
], |
| 1458 |
'frontend_available' => true, |
| 1459 |
] |
| 1460 |
); |
| 1461 |
|
| 1462 |
$this->add_responsive_control( |
| 1463 |
'distance_from_menu', |
| 1464 |
[ |
| 1465 |
'label' => __( 'Top Distance', 'easy-elements' ), |
| 1466 |
'type' => Controls_Manager::SLIDER, |
| 1467 |
'range' => [ |
| 1468 |
'px' => [ |
| 1469 |
'min' => -100, |
| 1470 |
'max' => 100, |
| 1471 |
], |
| 1472 |
], |
| 1473 |
'selectors' => [ |
| 1474 |
'{{WRAPPER}} nav.eel-nav-menu__layout-horizontal:not(.eel-dropdown) ul.sub-menu, {{WRAPPER}} nav.eel-nav-menu__layout-expandible.menu-is-active, {{WRAPPER}} nav.eel-nav-menu__layout-vertical:not(.eel-dropdown) ul.sub-menu' => 'margin-top: {{SIZE}}px;', |
| 1475 |
'{{WRAPPER}} .eel-dropdown.menu-is-active' => 'margin-top: {{SIZE}}px;', |
| 1476 |
], |
| 1477 |
'condition' => [ |
| 1478 |
'layout' => [ 'horizontal', 'vertical', 'expandible' ], |
| 1479 |
], |
| 1480 |
'frontend_available' => true, |
| 1481 |
] |
| 1482 |
); |
| 1483 |
|
| 1484 |
$this->add_responsive_control( |
| 1485 |
'icon_size', |
| 1486 |
[ |
| 1487 |
'label' => __( 'Icon Size', 'easy-elements' ), |
| 1488 |
'type' => Controls_Manager::SLIDER, |
| 1489 |
'range' => [ |
| 1490 |
'px' => [ |
| 1491 |
'min' => 15, |
| 1492 |
'max' => 25, |
| 1493 |
], |
| 1494 |
], |
| 1495 |
'selectors' => [ |
| 1496 |
'{{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item::before' => 'font-size: {{SIZE}}px;', |
| 1497 |
], |
| 1498 |
'condition' => [ |
| 1499 |
'layout' => [ 'horizontal' ], |
| 1500 |
], |
| 1501 |
'frontend_available' => true, |
| 1502 |
] |
| 1503 |
); |
| 1504 |
|
| 1505 |
$this->add_responsive_control( |
| 1506 |
'icon_distance_from_menu', |
| 1507 |
[ |
| 1508 |
'label' => __( 'Icon Top Distance', 'easy-elements' ), |
| 1509 |
'type' => Controls_Manager::SLIDER, |
| 1510 |
'range' => [ |
| 1511 |
'px' => [ |
| 1512 |
'min' => -100, |
| 1513 |
'max' => 100, |
| 1514 |
], |
| 1515 |
], |
| 1516 |
'selectors' => [ |
| 1517 |
'{{WRAPPER}} .eel-nav-menu .menu-item-has-children a.eel-menu-item::before' => 'top: {{SIZE}}%;', |
| 1518 |
], |
| 1519 |
'condition' => [ |
| 1520 |
'layout' => [ 'horizontal' ], |
| 1521 |
], |
| 1522 |
'frontend_available' => true, |
| 1523 |
] |
| 1524 |
); |
| 1525 |
|
| 1526 |
$this->add_control( |
| 1527 |
'heading_dropdown_divider', |
| 1528 |
[ |
| 1529 |
'label' => __( 'Divider', 'easy-elements' ), |
| 1530 |
'type' => Controls_Manager::HEADING, |
| 1531 |
'separator' => 'before', |
| 1532 |
] |
| 1533 |
); |
| 1534 |
|
| 1535 |
$this->add_control( |
| 1536 |
'dropdown_divider_border', |
| 1537 |
[ |
| 1538 |
'label' => __( 'Border Style', 'easy-elements' ), |
| 1539 |
'type' => Controls_Manager::SELECT, |
| 1540 |
'default' => 'solid', |
| 1541 |
'label_block' => false, |
| 1542 |
'options' => [ |
| 1543 |
'none' => __( 'None', 'easy-elements' ), |
| 1544 |
'solid' => __( 'Solid', 'easy-elements' ), |
| 1545 |
'double' => __( 'Double', 'easy-elements' ), |
| 1546 |
'dotted' => __( 'Dotted', 'easy-elements' ), |
| 1547 |
'dashed' => __( 'Dashed', 'easy-elements' ), |
| 1548 |
], |
| 1549 |
'selectors' => [ |
| 1550 |
'{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), |
| 1551 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child), |
| 1552 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child)' => 'border-bottom-style: {{VALUE}};', |
| 1553 |
], |
| 1554 |
] |
| 1555 |
); |
| 1556 |
$this->add_control( |
| 1557 |
'divider_border_color', |
| 1558 |
[ |
| 1559 |
'label' => __( 'Border Color', 'easy-elements' ), |
| 1560 |
'type' => Controls_Manager::COLOR, |
| 1561 |
'default' => '#c4c4c4', |
| 1562 |
'selectors' => [ |
| 1563 |
'{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), |
| 1564 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child), |
| 1565 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child)' => 'border-bottom-color: {{VALUE}};', |
| 1566 |
], |
| 1567 |
'condition' => [ |
| 1568 |
'dropdown_divider_border!' => 'none', |
| 1569 |
], |
| 1570 |
] |
| 1571 |
); |
| 1572 |
|
| 1573 |
$this->add_control( |
| 1574 |
'dropdown_divider_width', |
| 1575 |
[ |
| 1576 |
'label' => __( 'Border Width', 'easy-elements' ), |
| 1577 |
'type' => Controls_Manager::SLIDER, |
| 1578 |
'range' => [ |
| 1579 |
'px' => [ |
| 1580 |
'max' => 50, |
| 1581 |
], |
| 1582 |
], |
| 1583 |
'default' => [ |
| 1584 |
'size' => '1', |
| 1585 |
'unit' => 'px', |
| 1586 |
], |
| 1587 |
'selectors' => [ |
| 1588 |
'{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), |
| 1589 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child), |
| 1590 |
{{WRAPPER}} nav.eel-dropdown li.menu-item:not(:last-child)' => 'border-bottom-width: {{SIZE}}{{UNIT}}', |
| 1591 |
], |
| 1592 |
'condition' => [ |
| 1593 |
'dropdown_divider_border!' => 'none', |
| 1594 |
], |
| 1595 |
] |
| 1596 |
); |
| 1597 |
|
| 1598 |
$this->end_controls_section(); |
| 1599 |
|
| 1600 |
$this->start_controls_section( |
| 1601 |
'style_toggle', |
| 1602 |
[ |
| 1603 |
'label' => __( 'Menu Trigger & Close Icon', 'easy-elements' ), |
| 1604 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1605 |
] |
| 1606 |
); |
| 1607 |
|
| 1608 |
$this->start_controls_tabs( 'tabs_toggle_style' ); |
| 1609 |
|
| 1610 |
$this->start_controls_tab( |
| 1611 |
'toggle_style_normal', |
| 1612 |
[ |
| 1613 |
'label' => __( 'Normal', 'easy-elements' ), |
| 1614 |
] |
| 1615 |
); |
| 1616 |
|
| 1617 |
$this->add_control( |
| 1618 |
'toggle_color', |
| 1619 |
[ |
| 1620 |
'label' => __( 'Color', 'easy-elements' ), |
| 1621 |
'type' => Controls_Manager::COLOR, |
| 1622 |
'selectors' => [ |
| 1623 |
'{{WRAPPER}} div.eel-nav-menu-icon' => 'color: {{VALUE}}', |
| 1624 |
'{{WRAPPER}} div.eel-nav-menu-icon svg' => 'fill: {{VALUE}}', |
| 1625 |
], |
| 1626 |
] |
| 1627 |
); |
| 1628 |
|
| 1629 |
$this->add_control( |
| 1630 |
'toggle_background_color', |
| 1631 |
[ |
| 1632 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1633 |
'type' => Controls_Manager::COLOR, |
| 1634 |
'selectors' => [ |
| 1635 |
'{{WRAPPER}} .eel-nav-menu-icon' => 'background-color: {{VALUE}}; padding: 0.35em;', |
| 1636 |
], |
| 1637 |
] |
| 1638 |
); |
| 1639 |
|
| 1640 |
$this->end_controls_tab(); |
| 1641 |
|
| 1642 |
$this->start_controls_tab( |
| 1643 |
'toggle_hover', |
| 1644 |
[ |
| 1645 |
'label' => __( 'Hover', 'easy-elements' ), |
| 1646 |
] |
| 1647 |
); |
| 1648 |
|
| 1649 |
$this->add_control( |
| 1650 |
'toggle_hover_color', |
| 1651 |
[ |
| 1652 |
'label' => __( 'Color', 'easy-elements' ), |
| 1653 |
'type' => Controls_Manager::COLOR, |
| 1654 |
'selectors' => [ |
| 1655 |
'{{WRAPPER}} div.eel-nav-menu-icon:hover' => 'color: {{VALUE}}', |
| 1656 |
'{{WRAPPER}} div.eel-nav-menu-icon:hover svg' => 'fill: {{VALUE}}', |
| 1657 |
|
| 1658 |
], |
| 1659 |
] |
| 1660 |
); |
| 1661 |
|
| 1662 |
$this->add_control( |
| 1663 |
'toggle_hover_background_color', |
| 1664 |
[ |
| 1665 |
'label' => __( 'Background Color', 'easy-elements' ), |
| 1666 |
'type' => Controls_Manager::COLOR, |
| 1667 |
'selectors' => [ |
| 1668 |
'{{WRAPPER}} .eel-nav-menu-icon:hover' => 'background-color: {{VALUE}}; padding: 0.35em;', |
| 1669 |
], |
| 1670 |
] |
| 1671 |
); |
| 1672 |
|
| 1673 |
$this->end_controls_tab(); |
| 1674 |
|
| 1675 |
$this->end_controls_tabs(); |
| 1676 |
|
| 1677 |
$this->add_responsive_control( |
| 1678 |
'toggle_size', |
| 1679 |
[ |
| 1680 |
'label' => __( 'Icon Size', 'easy-elements' ), |
| 1681 |
'type' => Controls_Manager::SLIDER, |
| 1682 |
'range' => [ |
| 1683 |
'px' => [ |
| 1684 |
'min' => 15, |
| 1685 |
], |
| 1686 |
], |
| 1687 |
'selectors' => [ |
| 1688 |
'{{WRAPPER}} .eel-nav-menu-icon' => 'font-size: {{SIZE}}{{UNIT}}', |
| 1689 |
'{{WRAPPER}} .eel-nav-menu-icon svg' => 'font-size: {{SIZE}}px;line-height: {{SIZE}}px;height: {{SIZE}}px;width: {{SIZE}}px;', |
| 1690 |
], |
| 1691 |
'frontend_available' => true, |
| 1692 |
'separator' => 'before', |
| 1693 |
] |
| 1694 |
); |
| 1695 |
|
| 1696 |
$this->add_responsive_control( |
| 1697 |
'toggle_border_width', |
| 1698 |
[ |
| 1699 |
'label' => __( 'Border Width', 'easy-elements' ), |
| 1700 |
'type' => Controls_Manager::SLIDER, |
| 1701 |
'range' => [ |
| 1702 |
'px' => [ |
| 1703 |
'max' => 10, |
| 1704 |
], |
| 1705 |
], |
| 1706 |
'selectors' => [ |
| 1707 |
'{{WRAPPER}} .eel-nav-menu-icon' => 'border-width: {{SIZE}}{{UNIT}}; padding: 0.35em;', |
| 1708 |
], |
| 1709 |
'frontend_available' => true, |
| 1710 |
] |
| 1711 |
); |
| 1712 |
|
| 1713 |
$this->add_responsive_control( |
| 1714 |
'toggle_border_radius', |
| 1715 |
[ |
| 1716 |
'label' => __( 'Border Radius', 'easy-elements' ), |
| 1717 |
'type' => Controls_Manager::SLIDER, |
| 1718 |
'size_units' => [ 'px', '%' ], |
| 1719 |
'selectors' => [ |
| 1720 |
'{{WRAPPER}} .eel-nav-menu-icon' => 'border-radius: {{SIZE}}{{UNIT}}', |
| 1721 |
], |
| 1722 |
'frontend_available' => true, |
| 1723 |
] |
| 1724 |
); |
| 1725 |
|
| 1726 |
|
| 1727 |
|
| 1728 |
$this->end_controls_section(); |
| 1729 |
$this->start_controls_section( |
| 1730 |
'style_button', |
| 1731 |
[ |
| 1732 |
'label' => __( 'Button', 'easy-elements' ), |
| 1733 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1734 |
'condition' => [ |
| 1735 |
'menu_last_item' => 'cta', |
| 1736 |
], |
| 1737 |
] |
| 1738 |
); |
| 1739 |
|
| 1740 |
$this->add_group_control( |
| 1741 |
Group_Control_Typography::get_type(), |
| 1742 |
[ |
| 1743 |
'name' => 'all_typography', |
| 1744 |
'label' => __( 'Typography', 'easy-elements' ), |
| 1745 |
'selector' => '{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button', |
| 1746 |
] |
| 1747 |
); |
| 1748 |
$this->add_responsive_control( |
| 1749 |
'padding', |
| 1750 |
[ |
| 1751 |
'label' => __( 'Padding', 'easy-elements' ), |
| 1752 |
'type' => Controls_Manager::DIMENSIONS, |
| 1753 |
'size_units' => [ 'px', 'em', '%' ], |
| 1754 |
'selectors' => [ |
| 1755 |
'{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1756 |
], |
| 1757 |
'frontend_available' => true, |
| 1758 |
] |
| 1759 |
); |
| 1760 |
|
| 1761 |
$this->start_controls_tabs( '_button_style' ); |
| 1762 |
|
| 1763 |
$this->start_controls_tab( |
| 1764 |
'_button_normal', |
| 1765 |
[ |
| 1766 |
'label' => __( 'Normal', 'easy-elements' ), |
| 1767 |
] |
| 1768 |
); |
| 1769 |
|
| 1770 |
$this->add_control( |
| 1771 |
'all_text_color', |
| 1772 |
[ |
| 1773 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1774 |
'type' => Controls_Manager::COLOR, |
| 1775 |
'default' => '', |
| 1776 |
'selectors' => [ |
| 1777 |
'{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button' => 'color: {{VALUE}};', |
| 1778 |
], |
| 1779 |
] |
| 1780 |
); |
| 1781 |
|
| 1782 |
$this->add_group_control( |
| 1783 |
Group_Control_Border::get_type(), |
| 1784 |
[ |
| 1785 |
'name' => 'all_border', |
| 1786 |
'label' => __( 'Border', 'easy-elements' ), |
| 1787 |
'selector' => '{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button', |
| 1788 |
] |
| 1789 |
); |
| 1790 |
|
| 1791 |
$this->add_control( |
| 1792 |
'all_border_radius', |
| 1793 |
[ |
| 1794 |
'label' => __( 'Border Radius', 'easy-elements' ), |
| 1795 |
'type' => Controls_Manager::DIMENSIONS, |
| 1796 |
'size_units' => [ 'px', '%' ], |
| 1797 |
'selectors' => [ |
| 1798 |
'{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1799 |
], |
| 1800 |
] |
| 1801 |
); |
| 1802 |
|
| 1803 |
$this->add_group_control( |
| 1804 |
Group_Control_Box_Shadow::get_type(), |
| 1805 |
[ |
| 1806 |
'name' => 'all_button_box_shadow', |
| 1807 |
'selector' => '{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button', |
| 1808 |
] |
| 1809 |
); |
| 1810 |
|
| 1811 |
$this->end_controls_tab(); |
| 1812 |
|
| 1813 |
$this->start_controls_tab( |
| 1814 |
'all_button_hover', |
| 1815 |
[ |
| 1816 |
'label' => __( 'Hover', 'easy-elements' ), |
| 1817 |
] |
| 1818 |
); |
| 1819 |
|
| 1820 |
$this->add_control( |
| 1821 |
'all_hover_color', |
| 1822 |
[ |
| 1823 |
'label' => __( 'Text Color', 'easy-elements' ), |
| 1824 |
'type' => Controls_Manager::COLOR, |
| 1825 |
'selectors' => [ |
| 1826 |
'{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button:hover' => 'color: {{VALUE}};', |
| 1827 |
], |
| 1828 |
] |
| 1829 |
); |
| 1830 |
|
| 1831 |
$this->add_control( |
| 1832 |
'all_border_hover_color', |
| 1833 |
[ |
| 1834 |
'label' => __( 'Border Hover Color', 'easy-elements' ), |
| 1835 |
'type' => Controls_Manager::COLOR, |
| 1836 |
'default' => '', |
| 1837 |
'selectors' => [ |
| 1838 |
'{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button:hover' => 'border-color: {{VALUE}};', |
| 1839 |
], |
| 1840 |
] |
| 1841 |
); |
| 1842 |
|
| 1843 |
$this->add_group_control( |
| 1844 |
Group_Control_Box_Shadow::get_type(), |
| 1845 |
[ |
| 1846 |
'name' => 'all_button_hover_box_shadow', |
| 1847 |
'selector' => '{{WRAPPER}} .menu-item a.eel-menu-item.elementor-button:hover', |
| 1848 |
'separator' => 'after', |
| 1849 |
] |
| 1850 |
); |
| 1851 |
|
| 1852 |
$this->end_controls_tab(); |
| 1853 |
|
| 1854 |
$this->end_controls_tabs(); |
| 1855 |
|
| 1856 |
$this->end_controls_section(); |
| 1857 |
} |
| 1858 |
|
| 1859 |
/** |
| 1860 |
* Add itemprop for Navigation Schema. |
| 1861 |
* |
| 1862 |
* @since 1.5.2 |
| 1863 |
* @param string $atts link attributes. |
| 1864 |
* @access public |
| 1865 |
* @return string |
| 1866 |
*/ |
| 1867 |
public function handle_link_attrs( $atts ) { |
| 1868 |
|
| 1869 |
$atts .= ' itemprop="url"'; |
| 1870 |
return $atts; |
| 1871 |
} |
| 1872 |
|
| 1873 |
/** |
| 1874 |
* Add itemprop to the li tag of Navigation Schema. |
| 1875 |
* |
| 1876 |
* @since 1.6.0 |
| 1877 |
* @param string $value link attributes. |
| 1878 |
* @access public |
| 1879 |
* @return string |
| 1880 |
*/ |
| 1881 |
public function handle_li_values( $value ) { |
| 1882 |
|
| 1883 |
$value .= ' itemprop="name"'; |
| 1884 |
return $value; |
| 1885 |
} |
| 1886 |
|
| 1887 |
|
| 1888 |
/** |
| 1889 |
* Get the menu and close icon HTML. |
| 1890 |
* |
| 1891 |
* @since 1.5.2 |
| 1892 |
* @param array $settings Widget settings array. |
| 1893 |
* @access public |
| 1894 |
* @return array |
| 1895 |
*/ |
| 1896 |
public function get_menu_close_icon( $settings ) { |
| 1897 |
$menu_icon = ''; |
| 1898 |
$close_icon = ''; |
| 1899 |
$icons = []; |
| 1900 |
$icon_settings = [ |
| 1901 |
$settings['dropdown_icon'], |
| 1902 |
$settings['dropdown_close_icon'], |
| 1903 |
]; |
| 1904 |
|
| 1905 |
foreach ( $icon_settings as $icon ) { |
| 1906 |
if ( $this->is_elementor_updated() ) { |
| 1907 |
ob_start(); |
| 1908 |
\Elementor\Icons_Manager::render_icon( |
| 1909 |
$icon, |
| 1910 |
[ |
| 1911 |
'aria-hidden' => 'true', |
| 1912 |
'tabindex' => '0', |
| 1913 |
] |
| 1914 |
); |
| 1915 |
$menu_icon = ob_get_clean(); |
| 1916 |
} else { |
| 1917 |
$menu_icon = '<i class="' . esc_attr( $icon ) . '" aria-hidden="true" tabindex="0"></i>'; |
| 1918 |
} |
| 1919 |
|
| 1920 |
array_push( $icons, $menu_icon ); |
| 1921 |
} |
| 1922 |
|
| 1923 |
return $icons; |
| 1924 |
} |
| 1925 |
|
| 1926 |
/** |
| 1927 |
* Render Nav Menu output on the frontend. |
| 1928 |
* |
| 1929 |
* Written in PHP and used to generate the final HTML. |
| 1930 |
* |
| 1931 |
* @since 1.3.0 |
| 1932 |
* @access protected |
| 1933 |
* @return (void | false) |
| 1934 |
*/ |
| 1935 |
protected function render() { |
| 1936 |
|
| 1937 |
$menus = $this->get_available_menus(); |
| 1938 |
|
| 1939 |
if ( empty( $menus ) ) { |
| 1940 |
return false; |
| 1941 |
} |
| 1942 |
|
| 1943 |
$settings = $this->get_settings_for_display(); |
| 1944 |
|
| 1945 |
$menu_close_icons = []; |
| 1946 |
$menu_close_icons = $this->get_menu_close_icon( $settings ); |
| 1947 |
|
| 1948 |
if ( isset( $settings['enable_sticky_header'] ) && 'yes' === $settings['enable_sticky_header'] ) { |
| 1949 |
wp_enqueue_script( |
| 1950 |
'eel-sticky-header', |
| 1951 |
plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'widgets/navigation-menu/js/eel-sticky-header.js', |
| 1952 |
[ 'jquery' ], |
| 1953 |
EASYELEMENTS_VER, |
| 1954 |
true |
| 1955 |
); |
| 1956 |
} |
| 1957 |
|
| 1958 |
$args = [ |
| 1959 |
'echo' => false, |
| 1960 |
'menu' => $settings['menu'], |
| 1961 |
'menu_class' => 'eel-nav-menu', |
| 1962 |
'menu_id' => 'menu-' . $this->get_nav_menu_index() . '-' . $this->get_id(), |
| 1963 |
'fallback_cb' => '__return_empty_string', |
| 1964 |
'container' => '', |
| 1965 |
'walker' => new \Easyel_Menu_Walker(), |
| 1966 |
'menu_last_item' => $settings['menu_last_item'], |
| 1967 |
]; |
| 1968 |
|
| 1969 |
if ( 'yes' === $settings['schema_support'] ) { |
| 1970 |
$this->add_render_attribute( 'eel-nav-menu', 'itemscope', 'itemscope' ); |
| 1971 |
$this->add_render_attribute( 'eel-nav-menu', 'itemtype', 'https://schema.org/SiteNavigationElement' ); |
| 1972 |
|
| 1973 |
add_filter( 'Easyel_Menu_Walker_nav_menu_attrs', [ $this, 'handle_link_attrs' ] ); |
| 1974 |
add_filter( 'nav_menu_li_values', [ $this, 'handle_li_values' ] ); |
| 1975 |
} |
| 1976 |
|
| 1977 |
$this->add_render_attribute( |
| 1978 |
'eel-main-menu', |
| 1979 |
'class', |
| 1980 |
[ |
| 1981 |
'eel-nav-menu', |
| 1982 |
'eel-layout-' . $settings['layout'], |
| 1983 |
] |
| 1984 |
); |
| 1985 |
|
| 1986 |
$this->add_render_attribute( 'eel-main-menu', 'class', 'eel-nav-menu-layout' ); |
| 1987 |
|
| 1988 |
$this->add_render_attribute( 'eel-main-menu', 'class', $settings['layout'] ); |
| 1989 |
|
| 1990 |
$this->add_render_attribute( 'eel-main-menu', 'data-layout', $settings['layout'] ); |
| 1991 |
|
| 1992 |
|
| 1993 |
if ( 'yes' === $settings['fixed_top_sticky'] ) { |
| 1994 |
$this->add_render_attribute( 'eel-main-menu', 'class', 'eel-fixed-top-sticky' ); |
| 1995 |
|
| 1996 |
$inline_js = " |
| 1997 |
document.addEventListener('DOMContentLoaded', function() { |
| 1998 |
var header = document.querySelector('header.easy-site-header'); |
| 1999 |
if (header) { |
| 2000 |
header.classList.add('eel-fixed-top-sticky'); |
| 2001 |
} |
| 2002 |
}); |
| 2003 |
"; |
| 2004 |
|
| 2005 |
wp_add_inline_script( 'eel-sticky-header', $inline_js ); |
| 2006 |
} |
| 2007 |
|
| 2008 |
if ( 'cta' === $settings['menu_last_item'] ) { |
| 2009 |
|
| 2010 |
$this->add_render_attribute( 'eel-main-menu', 'data-last-item', $settings['menu_last_item'] ); |
| 2011 |
} |
| 2012 |
|
| 2013 |
if ( $settings['pointer'] ) { |
| 2014 |
if ( 'horizontal' === $settings['layout'] || 'vertical' === $settings['layout'] ) { |
| 2015 |
$this->add_render_attribute( 'eel-main-menu', 'class', 'eel-pointer__' . $settings['pointer'] ); |
| 2016 |
|
| 2017 |
if ( in_array( $settings['pointer'], [ 'double-line', 'underline', 'overline' ], true ) ) { |
| 2018 |
$key = 'animation_line'; |
| 2019 |
$this->add_render_attribute( 'eel-main-menu', 'class', 'eel-animation__' . $settings[ $key ] ); |
| 2020 |
} elseif ( 'framed' === $settings['pointer'] || 'text' === $settings['pointer'] ) { |
| 2021 |
$key = 'animation_' . $settings['pointer']; |
| 2022 |
$this->add_render_attribute( 'eel-main-menu', 'class', 'eel-animation__' . $settings[ $key ] ); |
| 2023 |
} |
| 2024 |
} |
| 2025 |
} |
| 2026 |
|
| 2027 |
if ( 'expandible' === $settings['layout'] ) { |
| 2028 |
$this->add_render_attribute( 'eel-nav-menu', 'class', 'eel-dropdown-expandible' ); |
| 2029 |
} |
| 2030 |
|
| 2031 |
|
| 2032 |
$this->add_render_attribute( |
| 2033 |
'eel-nav-menu', |
| 2034 |
'class', |
| 2035 |
[ |
| 2036 |
'eel-nav-menu__layout-' . $settings['layout'], |
| 2037 |
] |
| 2038 |
); |
| 2039 |
|
| 2040 |
$this->add_render_attribute( 'eel-nav-menu', 'data-toggle-icon', $menu_close_icons[0] ); |
| 2041 |
|
| 2042 |
$this->add_render_attribute( 'eel-nav-menu', 'data-close-icon', $menu_close_icons[1] ); |
| 2043 |
|
| 2044 |
$this->add_render_attribute( 'eel-nav-menu', 'data-full-width', $settings['full_width_dropdown'] ); |
| 2045 |
|
| 2046 |
if ( 'vertical' === $settings['layout'] && !empty($settings['menu_icon_vertical']['value']) ) { |
| 2047 |
$this->add_render_attribute('eel-nav-menu', 'data-vertical-icon', $settings['menu_icon_vertical']['value']); |
| 2048 |
} |
| 2049 |
|
| 2050 |
?> |
| 2051 |
|
| 2052 |
<div <?php $this->print_render_attribute_string( 'eel-main-menu' ); ?>> |
| 2053 |
<div role="button" class="eel-nav-menu__toggle elementor-clickable"> |
| 2054 |
<span class="screen-reader-text"><?php esc_html_e( 'Menu', 'easy-elements' ); ?></span> |
| 2055 |
<div class="eel-nav-menu-icon"> |
| 2056 |
<?php |
| 2057 |
if ( isset( $menu_close_icons[0] ) ) { |
| 2058 |
$menu_close_icon = str_replace( 'tabindex="0"', '', $menu_close_icons[0] ); |
| 2059 |
$allowed_svg = [ |
| 2060 |
'svg' => [ |
| 2061 |
'class' => true, |
| 2062 |
'xmlns' => true, |
| 2063 |
'width' => true, |
| 2064 |
'height' => true, |
| 2065 |
'viewbox' => true, |
| 2066 |
'aria-hidden' => true, |
| 2067 |
'role' => true, |
| 2068 |
'focusable' => true, |
| 2069 |
], |
| 2070 |
'path' => [ |
| 2071 |
'd' => true, |
| 2072 |
'fill' => true, |
| 2073 |
], |
| 2074 |
'g' => [ 'fill' => true ], |
| 2075 |
'title' => [], |
| 2076 |
]; |
| 2077 |
echo wp_kses( $menu_close_icon, $allowed_svg ); |
| 2078 |
} |
| 2079 |
?> |
| 2080 |
</div> |
| 2081 |
</div> |
| 2082 |
|
| 2083 |
<?php |
| 2084 |
$show_mobile_on_sidebar = isset( $settings['show_mobile_on_sidebar'] ) && 'yes' === $settings['show_mobile_on_sidebar']; |
| 2085 |
if ( $show_mobile_on_sidebar ) { |
| 2086 |
$this->add_render_attribute( 'eel-nav-menu-mobile', 'class', 'sidebar-on-mobile' ); |
| 2087 |
$widget_instance = $this; |
| 2088 |
add_action( 'wp_footer', function() use ( $args, $widget_instance ) { |
| 2089 |
?> |
| 2090 |
<nav <?php $widget_instance->print_render_attribute_string( 'eel-nav-menu-mobile' ); ?>> |
| 2091 |
<span class="eel-nav-menu-icon"> |
| 2092 |
<i class="unicon-close"></i> |
| 2093 |
</span> |
| 2094 |
<?php |
| 2095 |
printf( |
| 2096 |
'%s', |
| 2097 |
wp_nav_menu( |
| 2098 |
array_merge( |
| 2099 |
$args, |
| 2100 |
[ 'echo' => false ] |
| 2101 |
) |
| 2102 |
) |
| 2103 |
); |
| 2104 |
?> |
| 2105 |
</nav> |
| 2106 |
<?php |
| 2107 |
}); |
| 2108 |
} |
| 2109 |
?> |
| 2110 |
|
| 2111 |
<nav <?php $this->print_render_attribute_string( 'eel-nav-menu' ); ?>> |
| 2112 |
<?php echo wp_nav_menu( $args ); ?> |
| 2113 |
</nav> |
| 2114 |
</div> |
| 2115 |
<?php |
| 2116 |
} |
| 2117 |
} |