media_test_oembed.module in Drupal 10
Same filename and directory in other branches
Helper module for the Media oEmbed tests.
File
core/modules/media/tests/modules/media_test_oembed/media_test_oembed.moduleView source
<?php
/**
* @file
* Helper module for the Media oEmbed tests.
*/
use Drupal\media\OEmbed\Provider;
/**
* Implements hook_preprocess_media_oembed_iframe().
*/
function media_test_oembed_preprocess_media_oembed_iframe(array &$variables) {
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';
}
/**
* Implements hook_oembed_resource_url_alter().
*/
function media_test_oembed_oembed_resource_url_alter(array &$parsed_url, Provider $provider) {
if ($provider
->getName() === 'Vimeo') {
$parsed_url['query']['altered'] = 1;
}
}
Functions
Name | Description |
---|---|
media_test_oembed_oembed_resource_url_alter | Implements hook_oembed_resource_url_alter(). |
media_test_oembed_preprocess_media_oembed_iframe | Implements hook_preprocess_media_oembed_iframe(). |