2

I'm trying to do something pretty basic in my perspective, but I keep failing at this simple task.

My website has a main menu that is displayed on top of the page that is 2 levels deep (hence the Show as expanded). On the left toolbar it has another display of main menu, starting from level 2.

I have a main menu that looks like the following:

-link 1 (has option show as expanded)
--link 1.1
--link 1.2
-link 2 (has option show as expanded)
--link 2.1
--link 2.2

Problem now is that in the left toolbar all my level 2 links are always displayed, probably because I expand them. But I only want to view the children from my active trail.

Is this possible at all with the current setup? When I deselect Show as expanded, my top menu doesn't show the second level (except when I click the first level first = active trail).

Another problem with this new (menu) block system is that I use a template to render my main menu: menu--main.html.twig but both my top and left menu use this template. Is there any best practice to separate the templates?

  • Have you tried the Menu block module? – donquixote Aug 4 '15 at 12:27
  • It's D8, so doesn't have menu block – Johan Haest Aug 4 '15 at 12:58
  • Ah. Sorry. Then I have no idea :) I suppose some contrib work similar to menu_block or menupoly needs to happen in D8 then. – donquixote Aug 4 '15 at 13:49
  • D8 enables you to add custom blocks (of type Menu or type View) already. So menu_block seems useless, although I was able to do my functionality with menu_blocks without any problems. – Johan Haest Aug 4 '15 at 13:58
  • Did you ever figure out how to separate the templates for your menus?? I have the same issue. I want to have a different template for level 2 of the main menu. I was hoping I could expose the block id in the menu preprocess function and then use it in my main menu twig file, but I've been unsucessful. Any ideas on how I can accomplish this?? – chavab_1 Jun 15 '16 at 17:56
1

I also discovered that if "Show as expanded" is checked, the menu is displayed at sublevels where it should not appear. This patch fix this behavior:

https://www.drupal.org/node/2631468#comment-10792980

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.