Hi, I'm missing ability to have alt and title for image of video thumbnail. It's important for SEO and User experience. I suggest to use data from video name. Can you tune it up? (Don't forget for views)

CommentFileSizeAuthor
#2 youtube-add_title_and_alt-2051013-0.patch5.15 KB2pha
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guschilds’s picture

Title: Hi, I'm missing ability to have alt and title for image of video thumbnail » Missing ability to have alt and title for image of video thumbnail
Category: task » feature

This is complicated because the same field can display a video in one place and a thumbnail in another and the alt and title choices may not make much sense in the case of a video. The ability to add alt and title fields should probably be configurable via field settings (much how an Image field works).

That being said, this makes a lot of sense. It would be great if someone could supply a patch.

2pha’s picture

Status: Active » Patch (to be ported)
FileSize
5.15 KB

Patch attached that adds alt and title textfields.
The replacement patterns can be used when in views.
This is my first patch, so hopefully it works.

2pha’s picture

Status: Patch (to be ported) » Needs review

Changed status to needs review

guschilds’s picture

Status: Needs review » Needs work

2pha,

Thanks for the patch. I applied it locally to the 7.x-1.x branch and gave it a shot. I have a few questions:
* I found the ability to give an image an alt and title value from the field's manage display settings (admin/structure/types/manage/[content_type]/display). Does this mean all images for a given content type will have the same alt and title values?
* The field display settings mentioned in the above question are added in youtube_field_formatter_settings_form(). This exposes those same settings when using a YouTube Field in a view (and selecting to render the thumbnail). What do the youtube_views_handler_field additions provide? Could you provide steps as to why it is added?

Perhaps it may make more sense to add the alt and title fields into youtube_field_widget_form() so that individual videos could have different values. It should be up to the site builder (via field settings) as to whether these settings are available and/or required. This may also be a less confusing solution.

Thoughts?

Thanks again,
Gus

2pha’s picture

1. yes.
2. ability to use tokens/replacement patterns from the current view.

I only needed alt and title tags in the view, so this is what I concentrated on and did first. I only added the field's manage display settings after I had done the views integration. The way you mention would certainly be better I think.

jlongbottom’s picture

This is exactly what I need, however the patch is failing. I am using 7.x-1.0 too.

error: patch failed: youtube.info:6
error: youtube.info: patch does not apply

EDIT:

FYI: Patching by hand worked.

guschilds’s picture

eSentrik, Could you re-roll the patch so others can apply it successfully to 7.x-1.0? Thanks!

mgifford’s picture

Issue summary: View changes
Issue tags: +Accessibility
guschilds’s picture

Version: 7.x-1.0 » 8.x-1.x-dev

This should be involved with the development of #2085749: Iframe missing title tag.

The solution I'm still thinking might be best here would be to add a field setting with the following choices:

  1. No title (default, a generic title will be given)
  2. Allow a title to be provided for every field value (supplied by users)
  3. Provide a default title for all field values (includes textfield setting for that value)

This title can be applied to the iframe tag for videos and to thumbnail img tags. Would it be easiest if the same value is used for alt?

It should also work with Views.

This is needed for 8.x-1.x and 7.x-1.x.

  • guschilds committed c31fad6 on 7.x-1.x
    Issue #2051013 by 2pha, guschilds: Added default alt attribute values to...

  • guschilds committed 64f50c7 on 8.x-1.x
    Issue #2051013 by guschilds: Added default alt attribute values to...
guschilds’s picture

Title: Missing ability to have alt and title for image of video thumbnail » Missing ability to configure alt and title for image of video thumbnail

I've gone ahead and committed default alt values (based on the entity's title) to theme_youtube_thumbnail() in both the 7.x-1.x and 8.x-1.x branches. This is very similar to how the title tag is added to embedded iframes and addresses accessibility, but they are not yet configurable. I'm going to leave this open to determine the best route forward on where/how to make them configurable. More thoughts and patches are appreciated and in the meantime, overriding theme_youtube_thumbnail() would be one way to further customize these values.

guschilds’s picture

Status: Needs work » Closed (won't fix)

Closing after two years of inactivity from the community. I'm going to assume the previous commits are a worth compromise.