Card SDC: card_body_utility_classes not working when card_image_overlays is true

Created on 22 July 2025, 10 days ago

Problem/Motivation

Card SDC: card_body_utility_classes not working when card_image_overlays is true.

See: https://git.drupalcode.org/project/radix/-/blob/6.0.x/components/card/ca...

Steps to reproduce

      {% include 'radix:card' with {
        card_body: "Lorem ipsum dolar",
        card_image_overlays: true,
        card_body_utility_classes : [
          'bg-primary',
      ] %}

Proposed resolution

Merge card_body_utility_classes no matter if card_image_overlays is true or not.

Not sure whats the best approach here:

{%
  set card_body_classes = [
    card_image_overlays ? 'card-img-overlay' : 'card-body'
  ]|merge(card_body_utility_classes ?: [])
%}

or stick with the card_body_classes override and simply add the merge.

  {% if card_image_overlays %}
    {% if card_media|render %}
      {{ card_media }}
    {% elseif card_image_src %}
      {%
        include 'radix:image' with {
          src: card_image_src,
          image_utility_classes: card_image_classes|merge(['card-img'])
        }
      %}
    {% endif %}
    {%
      set card_body_classes = [
        'card-img-overlay'
      ]|merge(card_body_utility_classes ?: [])
    %}
  {% endif %}

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.0

Component

Code

Created by

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