By wim leers on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.8.x
Introduced in version:
8.8.0-alpha1
Issue links:
Description:
The ability to display Media entities from within a text field has been added, through the introduction of a new "Media embed" text filter (@Filter=media_embed).
This filter transforms <drupal-media> tags with the data-entity-type, data-entity-uuid and data-view-mode attributes into rendered media entities.
To use it:
- Go to Administration → Configuration → Content authoring → Text formats and editors
- Select a text format (e.g. Basic HTML)
- Check "Embed media" under "Enabled filters"
- Add
<drupal-media data-entity-type data-entity-uuid data-view-mode data-align data-caption>in "Limit allowed HTML tags and correct faulty HTML" (data-view-modeis optional as of #97) if the filter is enabled and "Save configuration".Note that this is also visible there, but for the purpose of testing this functionality, we don't need to change the default settings:
- Go to node add article (
/node/add/article) - Select "Source" from the CKEditor
- Add
<drupal-media data-align="center" data-caption="The first core Media embed ever." data-entity-type="media" data-entity-uuid="84911dc4-c086-4781-afc3-eb49b7380ff5"></drupal-media> <p>and</p> <drupal-media data-align="center" data-caption="This media entity is missing" data-entity-type="media" data-entity-uuid="wrong"></drupal-media>and save, you should now see:
Impacts:
Site builders, administrators, editors
Module developers
Themers
Site templates, recipes and distribution developers