We are using: drupal/dropzonejs: 2.0.0-alpha4, drupal/embed: 1.0.0, drupal/entity_browser: 2.2.0, drupal/entity_embed: 1.0.0 to embed a media Image in the body_field. when set the alt (alternative text) on a view “upload image” the alt description is missing:

<drupal-entity data-embed-button="media_entity_embed" data-entity-embed-display="entity_reference:media_thumbnail" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity-type="media" data-entity-uuid="3ec0436c-fa11-401a-9792-914de4865b77" data-langcode="en"></drupal-entity>

but if we set the alt description on embed-view it appear on the html tag.

<drupal-entity alt="Test description alt on embed view" data-embed-button="media_entity_embed" data-entity-embed-display="entity_reference:media_thumbnail" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity-type="media" data-entity-uuid="d036a679-0f6d-4dde-823c-a12e95078996" data-langcode="en"></drupal-entity>

0n configuration we tried disable the "Limit allowed HTML tags and correct faulty HTML" but didn't work.

If anyone can give some advice, we appreciated.

Comments

Mirelyj created an issue. See original summary.

Mirelyj’s picture

Title: Missing alt text attribure when embed image on body field. » Missing alt text attribute when embed image on body field.
Mirelyj’s picture

Issue summary: View changes
Mirelyj’s picture

StatusFileSize
new77.03 KB
Mirelyj’s picture

StatusFileSize
new893 bytes

This patch is to set/update the alt attribute, when the alt attribute is a empty string and the entity image field have value.
We are using dropzonejs as a plugin to upload image in ckEditor.

Mirelyj’s picture

Status: Active » Needs review
eric_a’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Needs review » Needs work

Patch #5 does provide the default alt text from the media entity. Thanks!

However, using language construct empty()is buggy in that it becomes impossible to enter value "0" as an override. (Values "0", NULL and FALSE will result in TRUE when passed to empty().)

I haven't looked into how core does this with core media. Not familiar with these plugins at all.