打印Drupal 8菜单

时间:2015-01-30 14:31:20

标签: drupal drupal-theming drupal-templates drupal-8

有没有人知道如何在Drupal 8中打印菜单?

我一直试图通过类似{{menu_primary}}的方式来获取它,但这并不起作用。我有几个自定义菜单,我基本上无法访问页面。

2 个答案:

答案 0 :(得分:1)

If I am understanding this correctly, the best way to do this would be to print a region in your theme and then place the menu via the block interface into that region. This would reduce any custom coding dependency to your menu and allow your theme to focus on the region layout it provides to your content (including menus).

Here is a link to the docs explaining how to properly setup regions in a D8 theme: https://www.drupal.org/node/2469113

I hope that helps!

Have fun,

Nick

答案 1 :(得分:0)

如果您使用bootstrap css并且想要打印子菜单,那么这很容易。这对您有用。 https://knackforge.com/blog/pathirakaliappan/create-multi-level-bootstrap-menu-in-Drupal-8