THEME HOOK: 'menu_link_content' - to use regions as well?

Created on 17 October 2023, about 1 year ago
Updated 20 May 2024, 6 months ago

Problem/Motivation

I have the full main menu in the header as the main site navigation. Some nodes will also have a main menu navigation block that only shows child links to one level from 'this' page.

A menu may have the region added to the template suggestion for menu--extras.html.twig, so the main menu in the primary navigation region has:
menu--extras--main--primary-menu.html.twig
and in the content region:
menu--extras--main--content.html.twig

In the menu--extras.html.twig template we can then alter {% import "menu-levels.html.twig" as menu %} to reference a specific twig template.

BUT, I cannot see how to change the menu-link-content.html.twig in use depending on where the menu is. The suggestions I have for both the header region and the content region are the same:

* menu-link-content--main--12--default.html.twig
* menu-link-content--main--12.html.twig
* menu-link-content--main--menu-level-0--default.html.twig
x menu-link-content--main--menu-level-0.html.twig
* menu-link-content--menu-level-0.html.twig
* menu-link-content--main--default.html.twig
* menu-link-content--main.html.twig
* menu-link-content--default.html.twig
* menu-link-content.html.twig

How can I add a region [or something else to distinguish between the two menus] to the menu-link-content.html.twig suggestions? for example, something like:
menu-link-content--main--primary-menu.html.twig
menu-link-content--main--content.html.twig

💬 Support request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

🇬🇧United Kingdom ice70

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ice70
  • First commit to issue fork.
Production build 0.71.5 2024