-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathnavigation-simulating-navigation-menus.vm
33 lines (22 loc) · 1.28 KB
/
navigation-simulating-navigation-menus.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<ul class="${prefix}-header-home__menu ${prefix}-header-menu-principal js-header-home-menu">
#set ($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($menuHeaderPrincipal = $layoutLocalService.fetchLayoutByFriendlyURL($layout.getGroupId(), false, "/menu-header-principal"))
#set ($currentPage = $themeDisplay.getLayout())
#foreach ($nav_item in $menuHeaderPrincipal.getChildren())
#set ($nav_item_attr_selected="")
#set ($nav_item_attr_has_popup="")
#set ($nav_item_css_class="lfr-nav-item")
#set ($portal = $portalUtil.getPortal())
#set ($link = $portal.getLayoutURL($nav_item, $themeDisplay))
#set ($nav_item_is_selected = $nav_item.isSelected(true, $currentPage, $currentPage.getAncestorPlid()))
#if ($nav_item_is_selected)
#set ($nav_item_attr_selected="aria-selected='true'")
#set ($nav_item_css_class="$nav_item_css_class selected active")
#end
<li class="$nav_item_css_class" id="layout_$nav_item.getLayoutId()" $nav_item_attr_selected role="presentation">
<a aria-labelledby="layout_$nav_item.getLayoutId()" href="$link" role="menuitem">
$nav_item.getName($locale)
</a>
</li>
#end
</ul>