Migrate style and remove unused data attributes used by entity_embed

Created on 27 August 2021, about 3 years ago
Updated 4 November 2023, about 1 year ago

Problem/Motivation

We notice there are 4 data attributes used by entity_embed which are not used anymore in drupal media tag.

Steps to reproduce

- Insert a media by using entity_embed via entity_browser with all options used, and find source code as

<drupal-entity alt="Termperature Icon" data-align="left" data-caption="test" data-embed-button="media_browser" data-entity-embed-display="media_image" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;file&quot;}" data-entity-type="media" data-entity-uuid="42aee921-5348-4c64-bb23-e04721660d96" title="Termperature Icon"></drupal-entity>

- Insert a media by using entity_embed via entity_browser with all options used, and find source code as

<drupal-media alt="test" data-align="left" data-caption="test" data-entity-type="media" data-entity-uuid="42aee921-5348-4c64-bb23-e04721660d96"></drupal-media>

- Install the module convert_entity_media_embed
- Run cron job
- Check the source code of the media tag

<drupal-media alt="Termperature Icon" data-align="left" data-caption="test" data-embed-button="media_browser" data-entity-embed-display="media_image" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;file&quot;}" data-entity-type="media" data-entity-uuid="42aee921-5348-4c64-bb23-e04721660d96" title="Termperature Icon"></drupal-media>

As you can see the following data attributes are not used but still present in the source code
- data-embed-button="media_browser"
- data-entity-embed-display="media_image"
- data-entity-embed-display-settings="{"image_style":"","image_link":""}"
- title="Termperature Icon"

Proposed resolution

1. remove unused data attributes
2. migrate data attributes of style to data-view-mode

Regarding the second point, it also requires one to one match from old style to new view mode in the media image.

Remaining tasks

TBD

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia eric.chenchao

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