API page: https://api.drupal.org/api/drupal/core!themes!stable!templates!navigatio...
I try to render the main navigation with all it's child menu items as a menu block in my navigation region. I configured the block under admin/structure/block/manage/THEMENAME as 'Initial menu level' 1 and 'Maximum number of menu levels to display' 2.
The menu has the following hierarchy.
-- menuitem
-- menuitem
-- menuitem (parent)
-- menuitem (child)
My main navigation consists of 2 levels which get rendered when I navigate to the menu item which has a child (e.g. parent). But I try to build a menu which renders all child elements on every level (also on toplevel / front, not only when I already navigated to the parent page which has a child). E.g. when you try to build a 2-level-hover-menu.
But the variable item.below in menu.html.twig is always empty on toplevel elements respectively if it is not the parent page ... e.g. front.
Any suggestions how to tackle this?
Comments
Comment #2
4aficiona2 commentedComment #3
4aficiona2 commentedComment #4
4aficiona2 commentedComment #5
4aficiona2 commentedComment #6
lewisnymanI'm not sure if thing is the same problem but I've seen people get tripped up because they have to enabl the “expanded” option for menu items before they will display their children.
Does that fix your problem?
Comment #7
4aficiona2 commentedOMG ... searched and debugged for hours but I did not actually head into the menu item itself. After checking the "expanded" option on the menu item the menu + subtree gets rendered as wished.
Thanks a lot for this advice! Saved my day!
Comment #8
4aficiona2 commentedIssue got resolved. Check #6
Comment #9
lewisnyman@4aficiona2 I suggest you open another issue to do something about the "expanded" option. Either we remove it or have it on by default. It seems like a clear Themer Experience issue.
Comment #10
4aficiona2 commentedComment #11
4aficiona2 commented@LewisNyman I opened a new issue where this can get discussed
Comment #12
4aficiona2 commentedComment #13
fredlllll commentedSorry to revive this dead thread, but i have the same problem. item.below is always empty in menu.html.twig which can be seen here
and my menu structure is here
the item real estate development has "show as expanded" enabled. im using drupal 8.2.6
its kinda critical that this works
Comment #14
alula.k commentedI had a similar problem but it turns out I have to configure the navigation block to display multiple levels. Check out
https://www.drupal.org/project/drupal/issues/2892134#comment-12382012