Skip to content
Snippets Groups Projects

Issue #3484323 by just_like_good_vibes: Component nav-menu : Don't show menu element when empty and no link

Merged Issue #3484323 by just_like_good_vibes: Component nav-menu : Don't show menu element when empty and no link
Files
3
@@ -15,6 +15,7 @@
{% if items %}
{% if menu_level == 0 %}
{% for item in items %}
{% if item.below or item.url %}
<li{{ item.attributes.addClass('fr-nav__item') }}>
{% if item.below %}
{% set item_id = menu_id ~ '-' ~ loop.index %}
@@ -34,14 +35,17 @@
</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% else %}
<ul class="fr-menu__list">
{% for item in items %}
{% if item.url %}
<li{{ item.attributes.addClass('fr-nav__item') }}>
<a class="fr-nav__link"
href="{{ item.url }}"{% if item.in_active_trail %} aria-current="page"{% endif %}>{{ item.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
@@ -52,6 +56,7 @@
{% if items %}
{% if menu_level == 0 %}
{% for item in items %}
{% if item.below or item.url %}
<li{{ item.attributes.addClass('fr-nav__item') }}>
{% if item.below %}
{% set item_id = menu_id ~ '-' ~ loop.index %}
@@ -69,6 +74,7 @@
</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% elseif menu_level == 1 %}
<div class="fr-container fr-container--fluid fr-container-lg">
@@ -94,6 +100,7 @@
</div>
{% endif %}
{% for item in items %}
{% if item.below or item.url %}
<div class="fr-col-12 fr-col-lg-3">
<h5 class="fr-mega-menu__category">
{% if not item.url %}
@@ -109,16 +116,19 @@
{{ _self.mega_menu_links(item.below, attributes, menu_level + 2, menu_id) }}
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% else %}
<ul class="fr-mega-menu__list">
{% for item in items %}
{% if item.url %}
<li{{ item.attributes }}>
<a class="fr-nav__link"
href="{{ item.url }}"{% if item.in_active_trail %} aria-current="page"{% endif %}>{{ item.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
Loading