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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

eric.chenchao created an issue. See original summary.

wim leers’s picture

+1

s_leu made their first commit to this issue’s fork.

s_leu’s picture

Status: Active » Needs review

Filed MR6 for this which should cover the two points in the proposed solution as of IS.

eelkeblok made their first commit to this issue’s fork.

  • eelkeblok committed d20c3328 on 1.0.x authored by s_leu
    Issue #3230092 by eric.chenchao, s_leu: Migrate style and remove unused...
eelkeblok’s picture

Status: Needs review » Fixed

Pulled a patch and used it on my own project. Works like a charm, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.