Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / media / media.api.php
1 <?php
2
3 /**
4  * @file
5  * Hooks related to Media and its plugins.
6  */
7
8 /**
9  * @addtogroup hooks
10  * @{
11  */
12
13 /**
14  * Alters the information provided in \Drupal\media\Annotation\MediaSource.
15  *
16  * @param array $sources
17  *   The array of media source plugin definitions, keyed by plugin ID.
18  */
19 function hook_media_source_info_alter(array &$sources) {
20   $sources['youtube']['label'] = t('Youtube rocks!');
21 }
22
23 /**
24  * Alters an oEmbed resource URL before it is fetched.
25  *
26  * @param array $parsed_url
27  *   A parsed URL, as returned by \Drupal\Component\Utility\UrlHelper::parse().
28  * @param \Drupal\media\OEmbed\Provider $provider
29  *   The oEmbed provider for the resource.
30  *
31  * @see \Drupal\media\OEmbed\UrlResolverInterface::getResourceUrl()
32  */
33 function hook_oembed_resource_url_alter(array &$parsed_url, \Drupal\media\OEmbed\Provider $provider) {
34   // Always serve YouTube videos from youtube-nocookie.com.
35   if ($provider->getName() === 'YouTube') {
36     $parsed_url['path'] = str_replace('://youtube.com/', '://youtube-nocookie.com/', $parsed_url['path']);
37   }
38 }
39
40 /**
41  * @} End of "addtogroup hooks".
42  */