Handle required `type: Drupal\Core\Template\Attribute`s props in SDCs

Created on 23 July 2025, 3 days ago

Overview

In How to pass content_attributes to SDC without it being shown in the XB UI Active we ensured handling all `type: Drupal\Core\Template\Attribute`s props (not only the one named `attributes`.

There's a very edgy case here that we want to have a test for: what happens when a `type: Drupal\Core\Template\Attribute` prop is marked as required?

Proposed resolution

a) Add a test (and ensure) that rendering it works even when the prop is not set. We expect SDC devs to initialize it.
b) Check requirements and disallow any SDC that has this kind of prop as required.

User interface changes

None.

📌 Task
Status

Active

Version

1.0

Component

Component sources

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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

Comments & Activities

  • Issue created by @penyaskito
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    A `type: Drupal\Core\Template\Attribute` prop can be marked as required, but that doesn't make any sense at all.

    a) Add a test (and ensure) that rendering it works even when the prop is not set. We expect SDC devs to initialize it.
    b) Check requirements and disallow any SDC that has this kind of prop as required.

    I'm inclined for option b.

Production build 0.71.5 2024