Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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)
Comment | File | Size | Author |
---|---|---|---|
#2 | youtube-add_title_and_alt-2051013-0.patch | 5.15 KB | 2pha |
Comments
Comment #1
guschilds CreditAttribution: guschilds commentedThis 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.
Comment #2
2phaPatch 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.
Comment #3
2phaChanged status to needs review
Comment #4
guschilds CreditAttribution: guschilds commented2pha,
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 theyoutube_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
Comment #5
2pha1. 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.
Comment #6
jlongbottom CreditAttribution: jlongbottom commentedThis is exactly what I need, however the patch is failing. I am using 7.x-1.0 too.
EDIT:
FYI: Patching by hand worked.
Comment #7
guschilds CreditAttribution: guschilds commentedeSentrik, Could you re-roll the patch so others can apply it successfully to 7.x-1.0? Thanks!
Comment #8
mgiffordComment #9
guschilds CreditAttribution: guschilds commentedThis 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:
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.
Comment #12
guschilds CreditAttribution: guschilds commentedI'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, overridingtheme_youtube_thumbnail()
would be one way to further customize these values.Comment #13
guschilds CreditAttribution: guschilds at Chromatic commentedClosing after two years of inactivity from the community. I'm going to assume the previous commits are a worth compromise.