Allow attributes to be added to off-canvas-page-wrapper.html.twig without having to fork the template.

Created on 18 August 2024, 4 months ago
Updated 19 August 2024, 4 months ago

Problem/Motivation

Drupal theme suggestions indicate that hook_off_canvas_page_wrapper() is available to affect the rendering of content using off-canvas-page-wrapper.html.twig. However, attributes cannot be added with hook_off_canvas_page_wrapper() without forking the system template, which seems a bit unnecessary.

The system template is missing {{ attributes }} in the main div wrapper.

Steps to reproduce

* Create a module or theme that includes hook_off_canvas_page_wrapper().
* Add code in the module/theme hook to add attributes to the template.

Expected behavior:
* Attributes added will appear in the markup.

Actual behavior:
* Attributes added do not appear.

Proposed resolution

Add {{ attributes }} to the system template.

Also for consistency, add {{ attributes }} to the stable9 template and the claro template so that module hooks adding attributes generally to the off-canvas-page-wrapper.html.twig via a module will also effectively add those attributes to the Claro theme, and to any theme created with Drupal's starterkit theme, which pulls templates from Stable9.

Remaining tasks

Patch is attached.

Data model changes

Data model changes to the templates have been added in the affected twig template files.

Release notes snippet

* Adds {{ attributes }} to off-canvas-page-wrapper.html.twig for theming purposes.

Feature request
Status

Needs work

Version

11.0 🔥

Component
Theme 

Last updated 4 days ago

Created by

🇺🇸United States lhridley

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024