class MediaTestOembedThemeHooks

Theme hook implementations for media_test_oembed.

Hierarchy

Expanded class hierarchy of MediaTestOembedThemeHooks

File

core/modules/media/tests/modules/media_test_oembed/src/Hook/MediaTestOembedThemeHooks.php, line 12

Namespace

Drupal\media_test_oembed\Hook
View source
class MediaTestOembedThemeHooks {
  
  /**
   * Implements hook_preprocess_media_oembed_iframe().
   */
  public function preprocessMediaOembedIframe(array &$variables) : void {
    if ($variables['resource']->getProvider()
      ->getName() === 'YouTube') {
      $variables['media'] = str_replace('?feature=oembed', '?feature=oembed&pasta=rigatoni', (string) $variables['media']);
    }
    // @see \Drupal\Tests\media\Kernel\OEmbedIframeControllerTest
    $variables['#attached']['library'][] = 'media_test_oembed/frame';
    $variables['#cache']['tags'][] = 'yo_there';
  }

}

Members

Title Sort descending Modifiers Object type Summary
MediaTestOembedThemeHooks::preprocessMediaOembedIframe public function Implements hook_preprocess_media_oembed_iframe().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.