Drupal 11 on node save form - Fatal error

Created on 16 April 2025, 3 days ago

Problem/Motivation

i posted the error in the wrong forum of video_embed_field: https://www.drupal.org/project/video_embed_field/issues/3519459 🐛 Drupal 11 on node save form - Fatal error Active

I get a Drupal 11 on node save form :

Fatal error: Declaration of Drupal\video_embed_facebook\Plugin\video_embed_field\Provider\Facebook::renderEmbedCode($width, $height, $autoplay) must be compatible with Drupal\video_embed_field\ProviderPluginInterface::renderEmbedCode($width, $height, $autoplay, $title_format = null, $use_title_fallback = true) in /var/www/html/docroot/web/modules/contrib/video_embed_facebook/src/Plugin/video_embed_field/Provider/Facebook.php on line 18

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇷Greece agelospanagiotakis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @agelospanagiotakis
  • First commit to issue fork.
  • 🇫🇷France mably

    I suggest to create a new 3.x branch for the 3.0.x compatible release.

  • 🇫🇷France mably

    It would be interesting to be able to fetch the video title using the FB graph API.

    Here is a piece of code ChatGPT generated that could be of some help to do that:

    use Drupal::httpClient;
    
    $video_id = '1234567890';
    $access_token = 'your-access-token';
    $response = \Drupal::httpClient()->get("https://graph.facebook.com/{$video_id}", [
      'query' => [
        'fields' => 'title',
        'access_token' => $access_token,
      ],
    ]);
    $data = json_decode($response->getBody(), true);
    $title = $data['title'] ?? 'Unknown Title';
    
  • 🇫🇷France mably

    And it looks like the thumbnail fetching code needs to be updated too:

    AI generated code posted here, just in case:

    use Drupal::httpClient;
    
    $video_id = '1234567890';
    $access_token = 'your-access-token';
    $response = \Drupal::httpClient()->get("https://graph.facebook.com/{$video_id}", [
      'query' => [
        'fields' => 'thumbnails',
        'access_token' => $access_token,
      ],
    ]);
    
    $data = json_decode($response->getBody(), true);
    $thumbnail_url = $data['thumbnails']['data'][0]['uri'] ?? NULL;
    
  • 🇫🇷France mably

    Will see what I can do if some people are interested.

Production build 0.71.5 2024