annotate core/modules/media/media.api.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Hooks related to Media and its plugins.
Chris@0 6 */
Chris@0 7
Chris@0 8 /**
Chris@0 9 * @addtogroup hooks
Chris@0 10 * @{
Chris@0 11 */
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Alters the information provided in \Drupal\media\Annotation\MediaSource.
Chris@0 15 *
Chris@0 16 * @param array $sources
Chris@0 17 * The array of media source plugin definitions, keyed by plugin ID.
Chris@0 18 */
Chris@0 19 function hook_media_source_info_alter(array &$sources) {
Chris@0 20 $sources['youtube']['label'] = t('Youtube rocks!');
Chris@0 21 }
Chris@0 22
Chris@0 23 /**
Chris@17 24 * Alters an oEmbed resource URL before it is fetched.
Chris@17 25 *
Chris@17 26 * @param array $parsed_url
Chris@17 27 * A parsed URL, as returned by \Drupal\Component\Utility\UrlHelper::parse().
Chris@17 28 * @param \Drupal\media\OEmbed\Provider $provider
Chris@17 29 * The oEmbed provider for the resource.
Chris@17 30 *
Chris@17 31 * @see \Drupal\media\OEmbed\UrlResolverInterface::getResourceUrl()
Chris@17 32 */
Chris@17 33 function hook_oembed_resource_url_alter(array &$parsed_url, \Drupal\media\OEmbed\Provider $provider) {
Chris@17 34 // Always serve YouTube videos from youtube-nocookie.com.
Chris@17 35 if ($provider->getName() === 'YouTube') {
Chris@17 36 $parsed_url['path'] = str_replace('://youtube.com/', '://youtube-nocookie.com/', $parsed_url['path']);
Chris@17 37 }
Chris@17 38 }
Chris@17 39
Chris@17 40 /**
Chris@0 41 * @} End of "addtogroup hooks".
Chris@0 42 */