Embedding rift images via CKEditor - or how to use rift inside the media entity.

Created on 9 July 2025, 3 days ago

Problem/Motivation

As I understand right now Media view modes are actually obsolte with rift. But for some cases it makes sense to use rift as an image formater inside view modes. For example to embedd images via CKEditor. Also if you want to extend the media entity with descriptions etc.

Proposed resolution

Lets create an image field formatter which actually is doing the same thing as reference formatter. What do you think?

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany Christian.wiedemann

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

Comments & Activities

  • Issue created by @Christian.wiedemann
  • 🇩🇪Germany D34dMan Hamburg

    Right now this is not supported via UI.

    However inside media template. You can use rift_picture Twig Function.

    Example in media.html.twig, you can do something as follows.

    {%
        set classes = [
        'media',
        'media--type-' ~ media.bundle()|clean_class,
        not media.isPublished() ? 'media--unpublished',
        view_mode ? 'media--view-mode-' ~ view_mode|clean_class,
    ]
    %}
    <div{{ attributes.addClass(classes) }}>
        {{ title_suffix.contextual_links }}
        {% if content %}
            {{ media|rift_picture('rift_view_mode_name') }}
            {{ content }}
        {% endif %}
    </div>
    
Production build 0.71.5 2024