Whitescreen on Twig render due to invalid attributes key and Attribute object usage

Created on 19 June 2025, 2 months ago

TB Mega Menu templates use the attributes key instead of the required #attributes in render arrays. Additionally, Drupal\Core\Template\Attribute objects are sometimes assigned directly to render array keys or treated like arrays, which breaks in Drupal 10 and 11.

These issues can cause white screens when rendering the menu in Twig, especially if the menu includes children.

Steps to reproduce

Create a twig template to style a view using TB Megamenu. The menu being styled should have children, You'll see a whitescreen referencing the twig template which is styling the output.

Proposed resolution

Replace usage of attributes with #attributes wherever they are intended for render arrays.
Replace usage of new Attribute() with plain arrays, or consistently use Attribute::addClass() etc. without treating the object like an array.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇦Canada alanstanley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024