I created a module in Drupal 8 called Footer and made it a block so I can include it in my Footer region in my theme.

I need my footer to have two menus, one listing topics and one listing static pages.

I created a new menu in the Drupal admin, but I don't understand how I can include it in my footer.

I tried adding it to my footer region, but then it's rendered next to my footer, not inside it.

I tried creating a new region and include it in my footer twig template but it doesn't work, I'm not sure how to do it.

What would be the best way to do it? I can include code, I'm just not sure what you need to help me.

I manage to get the new region in my html.html.twig template using page.footer_page_links but the same thing doesn't work in my footer module's twig file.

More generally, I'm wondering how to nest blocks in my template files.

  • This question is super confusing. If you change your module name to, I dunno, Penguin, it may be easier to understand. It's unclear which "Footer" you keep referring to here - the module as a block or the region at the bottom.
    – Deryck
    Commented Jan 7, 2015 at 0:07
  • @Deryck I see. Let's say my module is called Penguin then. I added it to the footer region and I can display it just fine. Now, inside my penguin plugin, I want to have a menu of links towards static pages. How can I call this menu from inside my module and display it in my penguin template? Commented Jan 7, 2015 at 0:09
  • What exactly does this Penguin module do other than hold a menu in your Footer Region? I get confused around the part about "I created a new menu...it's rendered next to my footer, not inside it." because it sounds like you're reversing the region > block concept logic.
    – Deryck
    Commented Jan 7, 2015 at 23:34
  • @Deryck I probably am. I'm new to Drupal and I'm having trouble understanding it. I'm basically wondering how to access a menu (or a block, more generally) from another block. Commented Jan 7, 2015 at 23:36
  • correct me if I'm wrong but it sounds like you want to hardcode a reference to a specific menu inside of the block so wherever that block goes, your menu goes. And if that's the case, does the block/module you're trying to contain the menu inside of have any other purpose?
    – Deryck
    Commented Jan 8, 2015 at 0:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.