0

I need to embed the 2nd level menu that show up in my 2nd level page /maintenance

in the next level page /maintenance/add-task

Drupal does not have this kind of setting, I'm looking a lot in the core files to try to figure out the proper API code to embed, one of my attempts:

$block = \Drupal\block\Entity\Block::load('block_modules_menu_second_level');
$variables['menu_second_level'] = \Drupal::entityTypeManager()
  ->getViewBuilder('block')
  ->view($block);

That code is for a simple block, or a custom block. How to evoke the drupal core menu level 2?

What am I missing?

2

Not quite sure, whether I got you right. Here's my guess: Depending on which theme you use, it may be that it is not a problem with the menu template. In my case, the (main) menu was configured to show only one level in the block settings.

I found out by chance, here is how to change it:

  1. Go to https://<yourdrupalpage>/admin/structure/block
  2. on the respective menu block item (e.g. main menu) click configure
  3. adjust the number of visible menu levels to your needs

that should to the trick

1
  • You just saved me a few hours of searching. You rock! – Sheedo Apr 30 '18 at 14:25

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.