Commit 9e826723 authored by alexpott's avatar alexpott

Issue #2609400 by tim.plunkett, effulgentsia, benjamin.merkley: menu.html.twig...

Issue #2609400 by tim.plunkett, effulgentsia, benjamin.merkley: menu.html.twig says that menu_name is an available variable, but it's not
parent ff9845ae
......@@ -1778,7 +1778,7 @@ function drupal_common_theme() {
),
// From menu.inc.
'menu' => array(
'variables' => array('items' => array(), 'attributes' => array()),
'variables' => array('menu_name' => NULL, 'items' => array(), 'attributes' => array()),
),
'menu_local_task' => array(
'render element' => 'element',
......
......@@ -177,6 +177,7 @@ public function build(array $tree) {
// Add the theme wrapper for outer markup.
// Allow menu-specific theme overrides.
$build['#theme'] = 'menu__' . strtr($menu_name, '-', '_');
$build['#menu_name'] = $menu_name;
$build['#items'] = $items;
// Set cache tag.
$build['#cache']['tags'][] = 'config:system.menu.' . $menu_name;
......
......@@ -135,6 +135,7 @@ public function providerTestBuildCacheability() {
'max-age' => Cache::PERMANENT,
],
'#sorted' => TRUE,
'#menu_name' => 'mock',
'#theme' => 'menu__mock',
'#items' => [
// To be filled when generating test cases, using $get_built_element().
......
......@@ -30,6 +30,7 @@ public function build(array $tree, $level = 0) {
$menu_name = $first_link->getMenuName();
// Add a more specific theme suggestion to differentiate this rendered
// menu from others.
$build['#menu_name'] = $menu_name;
$build['#theme'] = 'menu__toolbar__' . strtr($menu_name, '-', '_');
return $build;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment