Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
There's no menu specific identifier in the menu blocks and for that reason theming menu blocks might be hard.
Note: This is the tools menu.
<div class="block block-system block-menu" id="block-atdknkh9" role="navigation">
<h2>mR0u20MI</h2>
<div class="content">
<ul class="menu">
<li class="leaf"><a href="/test_page_display_menu_link" data-drupal-link-system-path="test_page_display_menu_link">New title</a></li>
</ul>
</div>
</div>
Proposed resolution
Discuss wheter we should have a menu specific class on menu blocks or not.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#16 | menu-class.jpg | 88.35 KB | rupeshghar |
Comments
Comment #1
lauriiiComment #14
DanielVezamenu_name is available in menu templates, so you can easily add this by overriding menu.html.twig in your theme or via preprocessing.
The question is should core add this by default rather than relying on the user to add this themselves. This is a 9 year old task without much traction, so bumping it for visibility and to see if people have thoughts on if we should do this or not.
Comment #16
rupeshghar CreditAttribution: rupeshghar at QED42 for Drupal India Association commentedIn the latest version of Drupal, the menu machine name is now included as a class for menus, providing a means to uniquely identify each menu.
Comment #17
smustgrave CreditAttribution: smustgrave at Mobomo commented@dawehner are you still seeing this issue?