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
Every time something changes in the menu templates, it usually has to be propagated to all three templates:
menu.html.twig
menu--main.html.twig
menu--account.html.twig
The code can easily be copy and pasted, but that is still essentially duplicating code and continues to leave an opportunity for human error to occur.
Proposed resolution
Consolidate the menu macro in main.html.twig
and use {% extends "menu.html.twig" %}
in menu--main.html.twig
and menu--account.html.twig
.
Refactor the macro in menu.html.twig
to pass classes for the <ul>
element.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2936370-2.patch | 5.87 KB | markhalliwell |
Comments
Comment #2
markhalliwell