Problem/Motivation
The Toolbar module is providing a theme override for the menu theme hook: menu__toolbar. This override does not provide all the variables from the base hook, which can cause the following notice in preprocess functions:
Notice: Undefined index: menu_name
Historically, this was caused during the early days of Drupal 8.0.x, when #2609400: menu.html.twig says that menu_name is an available variable, but it's not introduced the menu_name variable, but it was not realized at the time that this theme hook was overridden in the Toolbar module.
This is a minor issue because the notice only occurs when using a theme which does not provide a menu--toolbar.html.twig template. The core stable theme includes this, so all themes that extend the stable theme are not affected.
Steps to reproduce
Use a theme which does not use the stable base theme. The menu_name variable will not be available for the Toolbar menus.
Proposed resolution
Declare the menu_name variable in the theme override, so it is identical to the base theme hook that is declared in drupal_common_theme().
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3227370-3.patch | 1.21 KB | pfrenssen |
| #3 | 3227370-3-test_only.patch | 732 bytes | pfrenssen |
Comments
Comment #2
pfrenssenComment #3
pfrenssenPatch.
Comment #5
saidatomThanks! Looks good to me, this is now in RTBC.
Comment #7
pfrenssenWas affected by a random failure in automated re-testing. It's back to green now. Restoring status.
Comment #8
alexpottCommitted and pushed 117db6f91b to 9.3.x and 7a5d5cdd09 to 9.2.x. Thanks!