Clean blocks and menus presenter templates

Created on 6 February 2025, 2 months ago

Problem/Motivation

For architecture and accessibility reasons.

Needs to be backported in 1.0.

1. Remove block--system-menu-block--main.html.twig

The template is too specific. We need to target a menu template or a block template, not both.

https://git.drupalcode.org/project/ui_suite_dsfr/-/blob/1.1.x/templates/...

So, let's remove it. However, we will lose the logic introduced by 🐛 [beta4] Remove the forced menu title display when "display title" is set to false Fixed and we need to check we are OK with that.

2. Clean block wrappers

We have this in https://git.drupalcode.org/project/ui_suite_dsfr/-/blob/1.1.x/templates/...

{% if attributes is not empty %}

We need to check but it seems Drupal attributes object is never empty, because \Drupal\Core\Template\Attribute should implement Countable interface Active

So let's try this instead:

{% if attributes.storage() %}

3. Add block--system-menu-block.html.twig

Because there is that in Drupal Core https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/syste... which has priority on block.html.twig, we need to duplicate our already fixed block.html.twig in block--system-menu-block.html.twig

API changes

No

📌 Task
Status

Active

Version

1.1

Component

Code

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024