Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DS-1731 Handle nolink menu items properly. #260

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions templates/menu--main.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@
{% elseif item.url.options.attributes.class %}
{% set nav_link_classes = nav_link_classes|merge([item.url.options.attributes.class]) %}
{% endif %}
{% if item.url.isRouted and item.url.routeName is not same as '<nolink>' %}
{% set menu_item_href = "href=#{item.url|render}" %}
{% else %}
{% set menu_item_href = '' %}
{% endif %}
{% if item.below %}
<li class="dropdown nav-level-2 children">
<a href="{{ item.url }}" class="menu-link--level-1" aria-expanded="false" data-toggle="dropdown">
<a {{ menu_item_href }} class="menu-link--level-1" aria-expanded="false" data-toggle="dropdown">
{{ item.title }}&nbsp;
{{ chevron }}
</a>
{{ menus.menu_links_level_2(item.below, attributes, menu_level + 1, item) }}
</li>
{% else %}
<li class="dropdown nav-level-2">
<a href="{{ item.url }}" target="_self" class="menu-link--level-1">
<a {{ menu_item_href }} target="_self" class="menu-link--level-1">
{{ item.title }}&nbsp;
</a>
</li>
Expand All @@ -85,7 +90,12 @@
<a href="#" class="back">{{ navigationLinkLabel }}</a>
</div>
<div class="navigation-bottom">
<a href="{{ parent.url }}" class="main-menu-link--level-1">
{% if parent.url.isRouted and parent.url.routeName is not same as '<nolink>' %}
{% set menu_parent_href = "href=#{parent.url|render}" %}
{% else %}
{% set menu_parent_href = '' %}
{% endif %}
<a {{ menu_parent_href }} class="main-menu-link--level-1">
{{ parent.title }}
</a>
</div>
Expand Down