sartogo’s picture

Bump for this. Really need the ability to set the alt tag based on video attributes (at least default to video title for now so html can validate). This should also work on views.

Thanks for the great work!’s picture


btown’s picture

I'll second this. For accessibility purposes, this is a must.

superdorx’s picture


mgifford’s picture

Title: How to add title or alt attributes to thumbnail? » Add ALT attributes to thumbnail
Category: Support request » Bug report
Issue summary: View changes
Issue tags: +accessibility

I'm changing the title. Ultimately, Alt tags are more useful for accessibility than titles. There is a strong precedent for this in Core.

diego21’s picture

Category: Bug report » Feature request
Status: Active » Needs review
944 bytes

Simple patch to add this feature.

plopesc’s picture

Status: Needs review » Needs work

hey diego21

Thank you for your patch. It solves the problem fine in case you select the thumbnail formatter, but would be great if you could also gice this support in case you enable the colorbox module and select the 'Thumbnail Preview w/Colorbox' formatter.

Then you should play with the video_embed_field_colorbox_code theme callback to add there a new #image_alt property.

If you need some feedback, please ping me on IRC

diego21’s picture

Thanks @plopesc :-)

I think that now is ok.

plopesc’s picture

Hey @diego21, grea twork here

Your patch looks pretty good. I just have a question about this line:

+++ b/
@@ -452,6 +454,7 @@ function video_embed_field_field_formatter_view($entity_type, $entity, $field, $
+          '#alt' => $alt,

I think this line is not necessary here, video_embed_field_embed_code theme callback is related to the video player, and we are dealing with image thumbnails in this patch.

Could you confirm me that this line is not used anywhere and could be removed?

Thank you

diego21’s picture


You are right, that line is not necessary. Indeed, the hook_theme() wasn't difining that variable for video_embed_field display :-)

Thanks for the comment.

diego21’s picture

  • plopesc committed 4a51bf0 on 7.x-2.x authored by diego21
    Issue #1926872 by diego21: Add ALT attributes to thumbnail
plopesc’s picture

Status: Needs work » Fixed

Committed and pushed to 7.x-2.x

Thank you @diego21!!

Status: Fixed » Closed (fixed)

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