[Card] enum bg_boxes property missing download variant ?

Created on 23 June 2025, 12 days ago

Problem/Motivation

Hello,

We've noticed that there was a change on the card component regarding the bg_boxes property. It's now an enum field, it was a string field up to 1.4.2.

We're using the download variant on some cards (see https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants/c...)

Hence, 1.4.3 is breaking our theme.

Steps to reproduce

Create a card with a bg_boxes of value download.

Proposed resolution

Either add a "is_download" property OR add "download" in bg_boxes values.

I can provide a patch if needed, depending on the preferred approach.

Regards.

🐛 Bug report
Status

Active

Version

1.4

Component

Code

Created by

🇫🇷France plits

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

Comments & Activities

  • Issue created by @plits
  • 🇫🇷France S3b0uN3t Nantes

    Hello,

    Thank you for using the dsfr4drupal theme!

    The bg_boxes property is not intended to manage all card options.
    We have chosen to update its type to an enumeration to limit its use to the purposes mentioned by the DSFR (See "Fonds et encadrés").

    We apologize if this restriction caused regressions in your theme implementation.

    We also prefer to limit the variant property to the card size as is the case for the majority of components.

    There are so many possible options in cards that we don't plan to manage them all by properties today.

    To use a card in download mode, it would be preferable to define the class yourself in the attributes property:

    {% set attributes = attributes.addClass(['fr-card--download']) %}
    {{ include('dsfr4drupal:card', ...) }}
    

    or

    {{ include('dsfr4drupal:card', {
      'attributes': attributes.addClass(['fr-card--download']),
      ...
    }, with_context=false) }}
    

    or

    {{ include('dsfr4drupal:card', {
      'attributes': create_attribute({'class': ['fr-card--download']}),
      ...
    }, with_context=false) }}
    

    Regards,

  • 🇫🇷France plits

    Hello,

    Makes sense, will refactor with this usage then.

    Have a nice day.

Production build 0.71.5 2024