comparison core/modules/media/media.api.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
19 function hook_media_source_info_alter(array &$sources) { 19 function hook_media_source_info_alter(array &$sources) {
20 $sources['youtube']['label'] = t('Youtube rocks!'); 20 $sources['youtube']['label'] = t('Youtube rocks!');
21 } 21 }
22 22
23 /** 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 /**
24 * @} End of "addtogroup hooks". 41 * @} End of "addtogroup hooks".
25 */ 42 */