Issue #3227370 by pfrenssen: Toolbar menu theme override omits the 'menu_name' variable

(cherry picked from commit 117db6f91b)
merge-requests/561/head
Alex Pott 2021-10-16 17:09:57 +01:00
parent b5cfa7cfa4
commit 7a5d5cdd09
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
2 changed files with 12 additions and 1 deletions

View File

@ -48,3 +48,14 @@ function toolbar_test_toolbar() {
return $items;
}
/**
* Implements hook_preprocess_HOOK().
*/
function toolbar_test_preprocess_menu(&$variables) {
// All the standard hook_theme variables should be populated when the
// Toolbar module is rendering a menu.
foreach (['menu_name', 'items', 'attributes'] as $variable) {
$variables[$variable];
}
}

View File

@ -41,7 +41,7 @@ function toolbar_theme($existing, $type, $theme, $path) {
];
$items['menu__toolbar'] = [
'base hook' => 'menu',
'variables' => ['items' => [], 'attributes' => []],
'variables' => ['menu_name' => NULL, 'items' => [], 'attributes' => []],
];
return $items;