Card SDC: card_media not working when card_image_overlays is true

Created on 26 May 2025, 11 days ago

Problem/Motivation

When card_image_overlays is set to true card_media is never used.

Steps to reproduce

Add this:

{% include 'radix:card' with {
    card_media: content.field_coverimage.0 ? content.field_coverimage|field_value : '',
    card_title: label,
    title_link: url,
    card_subtitle: content.field_subtitle.0 ? content.field_subtitle|field_value : '',
    card_body: card_body_rendered is real_content ? card_body_rendered : '',
    card_image_overlays: true,
  } %}

Proposed resolution

Instead this:

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

Print card_media with the same conditions as used for slot_card_image_top and slot_card_image_bottom:

  {% 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'])
          }
        %}
        {%
          set card_body_classes = [
            'card-img-overlay'
          ]
        %}
     {% endif %}
  {% 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