Hello, by enable the module, it add me the suggestion "menu--[id of the menu].html.twig" on the top of the list of suggestions.
Without the module:
<!-- FILE NAME SUGGESTIONS:
x menu--footer-test.html.twig
* menu--footer.html.twig
* menu.html.twig
-->
and with "Menu Item Extras"
<!-- FILE NAME SUGGESTIONS:
x menu--footer.html.twig
* menu--footer-test.html.twig
x menu--footer.html.twig
* menu.html.twig
-->
and, "menu--footer.html.twig" is used instead of "menu--footer-test.html.twig"...
To make it works in me case, I need to comment the folling line in file "menu_item_extras.module":
// We have to add back the original suggestion that normally is generated
// from the #theme, because in pre-process we are replacing it with 'menu'.
//$suggestions[] = $utility::suggestion('menu', $menu_name);
Why?
Comments
Comment #2
kobb commentedI also had to comment out this line. The module overrides the block "Theme hook suggestion".
Comment #3
mbopp commentedPatch for change.
Comment #5
petr illekHi,
I've run in same issues.
The patch #3 works, but commenting out the code, does not feel as the approach I would like to go. It may break some other logic elsewhere in the module we are not aware of.
Instead of this we used a different approach with checking the final suggestion array for duplicates and leave only unique content (thanks for the help to @cferthorney). See the fork.
Comment #6
dave reidWe're seeing this as well. The suggestion order doesn't seem correct. The more generic menu--extras.html.twig suggestion is getting put in higher order above menu--MENU-NAME, which is not what we want. I think the order should be the following:
- menu--extras--MENU-NAME
- menu--MENU-NAME
- menu--extras
- menu
Comment #7
ozinHi all!
I can't reproduce this issue.
I'm using Olivero 9.1.3 as a default theme and I get these suggestions:
Could you provide more details which theme do you use and what is your base theme?
Comment #8
dave reidCan you try with the Classy or Stable themes? We're also using a manually rendered menu, not using a block, that may be part of it since we don't see the additional suggestions that include the region.
Also, menu--primary-menu.html.twig seems like an odd suggestion. Shouldn't it be menu--main--primary-menu.html.twig?
Comment #9
joelseguinI've come accross a relevant issue when I just recently updated to version 2.14 (from 2.13). My template overrides were broken after the upgrade as naming suggestions changed. I couldn't seem to be able to override as expected anymore and therefore have since reverted back to 2.13.
Here is what I used to get in 2.13:
I'm now getting the following in 2.14:
Note that I have three menus in the examples above (one of which was for testing purposes): menu_main, menu_main_off_canvas and menu_main_off_canvas_v2.
Comment #10
ozinComment #12
ozinHi @joelseguin,
Please check if the latest version 2.15 works for you?
Comment #13
joelseguinHi @ozin,
Just tested out 2.15 and all is working as expected. The template suggestions are the same as with 2.13 so no broken templates.
Thanks!
Comment #14
steveoriolWell done @ozin, I can confirm that the patch is working really well!
Thank you :-)
Comment #16
ozin