Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.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="{"image_style":"","image_link":""}" 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="{"image_style":"","image_link":""}" 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 30733911.patch | 893 bytes | Mirelyj |
| #4 | configuration.png | 77.03 KB | Mirelyj |
| embed-view-setAltValue.png | 31.82 KB | Mirelyj | |
| embed-view..png | 33.12 KB | Mirelyj | |
| UploadImage.png | 50.88 KB | Mirelyj |
Comments
Comment #2
Mirelyj commentedComment #3
Mirelyj commentedComment #4
Mirelyj commentedComment #5
Mirelyj commentedThis 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.
Comment #6
Mirelyj commentedComment #7
eric_a commentedPatch #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 toempty().)I haven't looked into how core does this with core media. Not familiar with these plugins at all.