Closed (outdated)
Project:
Media Directories
Version:
2.0.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Nov 2022 at 07:37 UTC
Updated:
2 Jul 2026 at 17:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ytsurkThank you for reporting this issue. I'll have a look at it.
Comment #3
rang501 commentedInitial try to fix it.
Comment #4
ytsurkBy just looking at the code, this looks fine.
You could move the call to decode within the if clause, so it get's only executed when needed.
Comment #5
ytsurkI tested now with browser - so, we're allowing the possibility to change the alt-text (+title) for the given media entity.
We do not change the attributes, only overwrite it for the current instance!
This patch helps not adding the attribute to the drupal-media-entity tag, but to the images renderer.
What is really the desired behavior here.
Override or use original? When the fields from the image formatter are empty, we currently show the (inital) placeholder value, which seems fine to me.
Still the title attribute should be treated the same like the alt attribute, so we would need another setting for media_image_title no?
Comment #7
rang501 commentedYeah, my patch probably wasn't correct.
I opened MR for the changes that should find media alt text and also default to media name in case alt is not set.
It doesn't fix the issue with overriding alt text during embedding. There we have an issue where entity_embed module doesn't pass other attributes to formatter and we don't have any information about customized alt text.
Comment #8
raphael apard commentedHi,
Thanks for your work. I'm using this Field Formatter on en entity (not a CKEditor field) and alt attributes is missing too.
Why not get alt from thumbnail ?
https://git.drupalcode.org/project/media_directories/-/blob/2.1.x/module...
Comment #9
raphael apard commentedHere my fix
Comment #11
ytsurkThis probably got forgotten ..
Comment #12
raphael apard commentedI think this is safer to use the getSource method to get the source field instead of using
thumbnail.I my case, alt text is not updated on
thumbnailafter editing the media.Here a patch for the 2.0.x version.
Comment #13
raphael apard commentedHere a patch for the 2.1.x version (including this fix: https://www.drupal.org/project/media_directories/issues/3366407).
Comment #14
rang501 commentedMarking as outdated. This version is not supported anymore.