Add Media Entity To All Templates

Created on 21 May 2025, 15 days ago

Problem/Motivation

Since Media entities are fieldable, we should be able to add fields to customize/configure the rendering. As one example, Buzzsprout allows you to show large or small versions of the player. You can show a single episode or entire channel. I can add fields to the media entity to select these choices, but the media entity is not accessible in the template.

Steps to reproduce

Add a field to one of the media types, then dump() in the twig template- note that the media entity is not added to the variables, and therefore the value of the added field is inaccessible.

Proposed resolution

Add the "media" entity as a variable in the formatter plugins and hook_theme variables.

User interface changes

None

API changes

Media entity (and therefore all fields on it) will be available in the remote media templates.

Data model changes

None

✨ Feature request
Status

Active

Version

1.9

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dgroene

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