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

CommentFileSizeAuthor
#3 3227370-3.patch1.21 KBpfrenssen
#3 3227370-3-test_only.patch732 bytespfrenssen

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Issue summary: View changes
pfrenssen’s picture

Status: Active » Needs review
StatusFileSize
new732 bytes
new1.21 KB

Patch.

The last submitted patch, 3: 3227370-3-test_only.patch, failed testing. View results

saidatom’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks good to me, this is now in RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: 3227370-3.patch, failed testing. View results

pfrenssen’s picture

Status: Needs work » Reviewed & tested by the community

Was affected by a random failure in automated re-testing. It's back to green now. Restoring status.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 117db6f91b to 9.3.x and 7a5d5cdd09 to 9.2.x. Thanks!

  • alexpott committed 117db6f on 9.3.x
    Issue #3227370 by pfrenssen: Toolbar menu theme override omits the '...

  • alexpott committed 7a5d5cd on 9.2.x
    Issue #3227370 by pfrenssen: Toolbar menu theme override omits the '...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.