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.
Can this module display the youtube title as it currently does with the thumbnail and video?
Comment | File | Size | Author |
---|---|---|---|
#4 | youtube-get-video-title-from-id-1916756-4.patch | 572 bytes | guschilds |
Comments
Comment #1
guschilds CreditAttribution: guschilds commentedThis module does not store the title of the YouTube video in the database and there aren't any plans to do so. However, you can use YouTube's API to get a video's title when given the video_id. I've attached a patch that adds a youtube_get_video_title_by_id() function to the module. Perhaps you can use this where you need the title. For example, once you've grabbed the video_id from the node object:
I got the code for this function from this StackOverflow answer. Not sure about this getting committed, but I hope it helps!
Thanks,
Gus
Comment #2
borgeous CreditAttribution: borgeous commentedthis is awesome, will this also add the field in the display formatter box? along with youtube and thumbnail?
Comment #3
guschilds CreditAttribution: guschilds commentedIt will not by default, nor is there an option to do so, but you can insert it yourself in one of a few ways:
Either one should allow you to wrap it in whatever HTML element you'd like.
Comment #4
guschilds CreditAttribution: guschilds commentedAttaching an update to the function in the previous patch, created while working on #2085749: Iframe missing title tag.
Comment #4.0
guschilds CreditAttribution: guschilds commentedgrammar
Comment #5
guschilds CreditAttribution: guschilds commentedClosing this because the function will not be committed to the module, as there are no plans to use it. The biggest downside to using it is adding an extra request every time this title is needed (unless caching was added). Perhaps if more interest is shown or use cases arise, it could be reconsidered. In the meantime, hopefully anyone needing this function will find it here (#4) and will be able to make us of it within their custom code.