Direct formatter for media items

Created on 13 January 2023, almost 2 years ago
Updated 22 March 2023, over 1 year ago

Problem/Motivation

When a site uses images from the media library, it takes a long chain of configuration to display images with a given responsive image style and correct loading or fetchpriority setting. See 🌱 [meta] Add fetchpriority=high on certain images/oembeds Active for the later. When multiple node types (or other entities /w bundles) with multiple view modes require images with different styles, each variation requires its own chain of configuration.

Data chain: Node > Entity reference field > Image/Video media > Image/Video field
Format chain: Node view mode > Entity reference field formatter > Image/Video media view mode > Image/Video field formatter > (responsive) image style or oEmbed configuration. The Image/Video formatter at the end of this chain can have loading=eager/lazy and (eventually) fetchpriority settings. Plus, there might be other description fields, etc on the media item. But main difference from one place to another for a Media view mode is the size of the media. We need teaser and hero sizes. Probably some medium and various other sizes too. Instead of creating each of those view modes, then cloning them one, two, three times to get all the right combinations of loading and fetchpriority settings with the _exact same size_ media rendering, we have view modes growing like bananas. We should have some nice view modes for Teaser and Hero. Then where ever the media reference is present, we can override the rendering of the media to render all images and oembeds to use loading="eager" fetchpriority="high". No need to fork the original media view modes any more. Folks will actually _do it_ and the world will be a better, faster place.

Proposed resolution

Introduce a new field formatter for entity reference fields that reference media entities to shorten the format chain.

New format chain: Node view mode > Direct media formatter w loading/fetchpriority

Remaining tasks

t.b.d.

User interface changes

New formatter for Entity reference fields referring to media.

Release notes snippet

t.b.d.

πŸ“Œ Task
Status

Closed: duplicate

Version

10.1 ✨

Component
MediaΒ  β†’

Last updated 4 days ago

Created by

heddn Nicaragua

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024