Support from Acquia helps fund testing for Drupal Acquia logo

Comments

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!

omar.mcknz@gmail.com’s picture

Agreed.

btown’s picture

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

superdorx’s picture

Agreed

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
FileSize
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/video_embed_field.field.inc
@@ -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

Fixed.

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.

llribas’s picture

Component: Miscellaneous » Code

Sorry,

I also need the alt text when you select "Thumbnail preview" as the field formatter, but I can't find the option for this!

I installed the last 7.x-2.x-dev and also 7.x-2.0-beta11, but I can't find the option for a tokenized or default alt text, maybe I'm looking for it in the wrong place, I spect it in:
Content types » Article » Manage display

and when I select "Thumbnail preview" for the video field, I expected to find something in the field configuration.

Where are these new options for thumbnails alt text?

thank you

llribas’s picture

Ok, as I see you need to activate the "Description" for the video field, then, the text in the "Description" is used as "alt text" when you use the "Thumbnail preview" formatter.

But:
1. If you use "views" to display the field, you can't choose to "hide" the "description", and it's always displayed after the thumbnail (but the alt text in the thumbnail image is inserted fine).
2. In the formatter options, if you choose to not show the description, then the text in the description is not used to fill the "alt text" for the thumbnail image, so the "alt text" is empty. Then, you only get the "alt text" filled with the "description" text if you choose to "show description" (at the top or the bottom of the image), and this looks repetitive for SEO purposes.

I think it should always include the "alt text" (also if you choose to "hide" the description), and have the option to also choose how to display it in views settings.

Thank you

dak5859’s picture

Does anyone on this thread know if a solution for this issue has been provided for the use of the Video Embed field in D8 core media module video type? We have a view that's showing video items and the thumbnail image for the video does not have alt text. Any help with this issue would be greatly appreciated (e.g. the patch used for D7 version of Video Embed in this thread).