There already is an Entity Embed module for Drupal 8, that is tightly integrated with new Drupal 8 features. It relies on the filter system to replace abstract placeholders with actual rendered representations of embedded entities. For that purpose, it uses data-entity-type
and data-entity-uuid
attributes.
This is very, very similar to what editor.module
uses for inserted images in Drupal 8 core: that uses data-editor-file-uuid
attributes on <img>
tags to know which file entity is associated with an image. That is used to easily switch to another image, to allow for different image styles on that image, but also to track where each image is used.
The Entity Embed module wants to have this tracking as well. And the Entity Embed module is going to be a key part of the Media module eco system in Drupal 8, and is already fairly mature. It has every semblance that Entity Embed is going to be one of the most installed modules on Drupal 8 sites.
The Text Editor (editor.module
) had to choose a namespaced data-
attribute back when it was introduced because it wasn't certain yet how contrib was going to work. But now that the most important contrib module in this area is already ready, it's clear that we're going to end up with a standard/convention of using the generic data-entity-type
and data-entity-uuid
attributes. In that case, it makes more sense for editor.module
to support that standard/convention already.
This will greatly enhance consistency during the Drupal 8 lifecycle and hence also improve usability (no more WTFs about why files embedded by editor.module
aren't treated the same as those embedded by entity_embed.module
).
For existing D8 sites with content that uses images inserted via CKEditor, this means your existing content needs to be updated accordingly: replace data-editor-file-uuid="
with data-entity-type="file" data-entity-uuid="
.
- Before:
<img alt="Hipster llama!" data-editor-file-uuid="0ee3c362-3d4e-447a-a41e-30a70d679815" src="/sites/default/files/field/image/hipster llama.jpg" />
- After:
<img alt="Hipster llama!" data-entity-type="file" data-entity-uuid="0ee3c362-3d4e-447a-a41e-30a70d679815" src="/sites/default/files/field/image/hipster llama.jpg" />