Add "title" attribute to YouTube, Vimeo, and Playlist embeds

Created on 24 February 2021, over 3 years ago
Updated 8 June 2023, about 1 year ago

Vimeo links return the title when getName() is called in drupal/modules/contrib/video_embed_field/src/Plugin/video_embed_field/Provider/Vimeo.php

Would like to add that to YouTube and YouTubePlaylists.

📌 Task
Status

Needs review

Version

2.0

Component

Video Embed Field (base module)

Created by

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland sokru

    Based on patch from #11, but I made few small improvements:
    1. No new translation strings, since there's almost 80k installations and some/many of them might have made translations.
    2. Removed unrelated coding standard fixes, so its easier to review and get committed.
    3. Corrected the return type of oEmbedData()

    Added the related issue 📌 Accessibility enhancements for html output of iframe tag (title, id, name, inner A link) Needs review . Patch → on issue has some related/duplicate code, but it has two interesting features that might be left for follow-up:
    - Transliterates and removes some unwanted characters from the title.
    - Adds $instace_id argument to renderEmbedCode, so title's will be unique if there's multiple instances of same video on page.

  • 🇫🇮Finland sokru

    And caching the response.

  • 🇫🇮Finland sokru

    Added the tests and removed single undefined function (filterCharaters()) from patch on #13.

  • 🇫🇮Finland sokru

    This fixes the tests other than ProviderUrlParseTest. That would need updating mocks. I'm willing to do that, if that increases the changes of commit.

  • Status changed to RTBC over 1 year ago
  • 🇨🇦Canada RobLoach Earth

    Thanks for the fixes +1

  • 🇫🇮Finland sokru

    And small improvement by handling the cases if returned json is not valid.

  • 🇫🇮Finland sokru

    And small improvement by handling the cases if returned json is not valid.

  • Status changed to Needs review over 1 year ago
  • 🇫🇷France DYdave

    Watchout: #11 is the last patch supported on PHP:7.4.

    All the more recent patches contributed afterwards (#12 to #18) use the null safe operator (?->) which is supported from PHP 8 onwards, therefore crashes on PHP 7.4, with the following error:

    The website encountered an unexpected error. Please try again later.
    ParseError: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in Composer\Autoload\{closure}() (line 110 of modules/contrib/video_embed_field/src/Plugin/video_embed_field/Provider/YouTube.php).

    It would be great if we could get a more recent version of the patch compatible with 7.4, but that's not necessarily a priority,

    Otherwise, patch from #18 works great on PHP 8.1.

    Thanks again to everyone for the great help with this ticket and contributions.

  • 🇫🇮Finland sokru

    Small change to decrease severity of logging. This could be debated, but the reasoning is that it will produce noise to logs (eg. when forwarding only emergency/critical/error messages to log service) everytime private video is rendered on cold caches.

Production build 0.69.0 2024