Does not cast options label in styles definitions

Created on 10 February 2025, 27 days ago

Problem/Motivation

Trying to add a card on layout builder with ui_patterns2 and ui_suite_dsfr, i have the following error generating /ui_styles/stylesheet


InvalidArgumentException: $string ("0") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 132 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php).

Drupal\ui_styles\Definition\StyleDefinition->t(0) (Line: 156)
Drupal\ui_styles\Definition\StyleDefinition->getOptionsAsOptions() (Line: 217)
Drupal\ui_styles\Service\StylesheetGenerator->getThemeStyleOptions('ui_suite_dsfr') (Line: 68)

ui_suite_dsfr has some style options with int, not string

  options:
    fr-m-0: 0

Proposed resolution

Cast to string in \Drupal\ui_styles\Definition\StyleDefinition::getOptionsAsOptions()

        $options[$option_id] = $this->t((string) $option);
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France goz

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

Comments & Activities

Production build 0.71.5 2024