diff --git a/core/modules/media/config/schema/media.schema.yml b/core/modules/media/config/schema/media.schema.yml index ab54a9029b..084d8097b5 100644 --- a/core/modules/media/config/schema/media.schema.yml +++ b/core/modules/media/config/schema/media.schema.yml @@ -73,7 +73,7 @@ media.source.video_file: media.source.oembed:*: type: media.source.field_aware - label: 'Remote Video media source configuration' + label: 'oEmbed media source configuration' mapping: thumbnails_location: type: string diff --git a/core/modules/media/media.module b/core/modules/media/media.module index 97f0ae846c..91bcebd305 100644 --- a/core/modules/media/media.module +++ b/core/modules/media/media.module @@ -14,7 +14,7 @@ use Drupal\Core\Url; use Drupal\field\FieldConfigInterface; use Drupal\media\MediaInterface; -use Drupal\media\Plugin\media\Source\OEmbed; +use Drupal\media\Plugin\media\Source\OEmbedInterface; /** * Implements hook_help(). @@ -88,6 +88,7 @@ function media_entity_access(EntityInterface $entity, $operation, AccountInterfa */ function media_theme_suggestions_media(array $variables) { $suggestions = []; + /** @var \Drupal\media\MediaInterface $media */ $media = $variables['elements']['#media']; $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); @@ -95,13 +96,10 @@ function media_theme_suggestions_media(array $variables) { $suggestions[] = 'media__' . $media->bundle(); $suggestions[] = 'media__' . $media->bundle() . '__' . $sanitized_view_mode; - /** @var \Drupal\media\Entity\MediaType $media_type */ - $media_type = \Drupal::entityTypeManager()->getStorage('media_type')->load($media->bundle()); - if ($media_type->getSource() instanceof OEmbed) { - $provider = $media_type->getSource()->getMetadata($media, 'provider_name'); - $provider = \Drupal::transliteration()->transliterate($provider); + if ($media->getSource() instanceof OEmbed) { + $provider_id = $media->getSource()->getMetadata($media, 'provider_id'); $suggestions[] = 'media__oembed'; - $suggestions[] = 'media__oembed__' . strtolower($provider); + $suggestions[] = 'media__oembed__' . strtolower($provider_id); } return $suggestions; @@ -111,39 +109,32 @@ function media_theme_suggestions_media(array $variables) { * Implements hook_field_widget_WIDGET_TYPE_form_alter(). */ function media_field_widget_string_textfield_form_alter(array &$element, FormStateInterface $form_state, array $context) { - if (!empty($element['value'])) { - /** @var \Drupal\media\MediaInterface $media */ - $media = $context['items']->getEntity(); - if (!($media instanceof MediaInterface) || !($media->getSource() instanceof OEmbed)) { - return; - } - - $field_definition = $context['items']->getFieldDefinition(); - $source_config = $media->getSource()->getConfiguration(); - // Only change the value field description on the source field. - if ($source_config['source_field'] != $field_definition->getName()) { - return; - } - - $source_definition = $media->getSource()->getPluginDefinition(); - $allowed_providers = $source_definition['supported_providers']; - if (!empty($source_config['allowed_providers'])) { - $allowed_providers = $source_config['allowed_providers']; - } - - $message = t('These oEmbed providers are allowed: @providers', ['@providers' => implode(', ', $allowed_providers)]); - if (!empty($element['value']['#description'])) { - $element['value']['#description'] = [ - '#theme' => 'item_list', - '#items' => [$element['value']['#description'], $message], - ]; - } - else { - $element['value']['#description'] = [ - '#theme' => 'item_list', - '#items' => [$message], - ]; - } + /** @var \Drupal\media\MediaInterface|OEmbedInterface $media */ + $media = $context['items']->getEntity(); + /** @var \Drupal\media\Plugin\media\Source\OEmbedInterface $source */ + $source = $media->getSource(); + if (empty($element['value']) || !($media instanceof MediaInterface) || !($source instanceof OEmbedInterface)) { + return; + } + + $field_definition = $context['items']->getFieldDefinition(); + // Only change the value field description on the source field. + if ($source->getSourceFieldDefinition($media->bundle->entity)->getName() != $field_definition->getName()) { + return; + } + + $message = t('You can link to media from the following services: @providers', ['@providers' => implode(', ', $source->getAllowedProviders())]); + if (!empty($element['value']['#description'])) { + $element['value']['#description'] = [ + '#theme' => 'item_list', + '#items' => [$element['value']['#description'], $message], + ]; + } + else { + $element['value']['#description'] = [ + '#theme' => 'item_list', + '#items' => [$message], + ]; } } diff --git a/core/modules/media/src/MediaSourceBase.php b/core/modules/media/src/MediaSourceBase.php index 3bb3c6699a..9e92c6c1f9 100644 --- a/core/modules/media/src/MediaSourceBase.php +++ b/core/modules/media/src/MediaSourceBase.php @@ -303,7 +303,7 @@ public function createSourceField(MediaTypeInterface $type) { protected function getSourceFieldName() { // Some media sources are using a deriver, so their plugin IDs are // containing a ':' which is not allowed for field names. - $base_id = 'field_media_' . str_replace(':', '_', $this->getPluginId()); + $base_id = 'field_media_' . $this->getDerivativeId(); $tries = 0; $storage = $this->entityTypeManager->getStorage('field_storage_config'); diff --git a/core/modules/media/src/OEmbed/Endpoint.php b/core/modules/media/src/OEmbed/Endpoint.php index 2eefde9a16..4b9dc768f8 100644 --- a/core/modules/media/src/OEmbed/Endpoint.php +++ b/core/modules/media/src/OEmbed/Endpoint.php @@ -14,6 +14,13 @@ class Endpoint { */ protected $url; + /** + * The provider this endpoint belongs to. + * + * @var \Drupal\media\OEmbed\Provider + */ + protected $provider; + /** * List of URL schemes supported by the provider. * @@ -25,6 +32,8 @@ class Endpoint { * List of supported formats. * * @var string[] + * + * @see https://oembed.com/#section2 */ protected $formats; @@ -40,6 +49,8 @@ class Endpoint { * * @param string $url * The endpoint's URL. + * @param \Drupal\media\OEmbed\Provider $provider + * The provider this endpoint belongs to. * @param array $schemes * List of URL schemes supported by the provider. * @param array $formats @@ -47,13 +58,14 @@ class Endpoint { * @param bool $supports_discovery * Whether the provider supports oEmbed discovery. * - * @throws \Drupal\media\OEmbed\ProviderException + * @throws \InvalidArgumentException */ - public function __construct($url, array $schemes = [], array $formats = [], $supports_discovery = FALSE) { + public function __construct($url, Provider $provider, array $schemes = [], array $formats = [], $supports_discovery = FALSE) { if (!$url) { - throw new ProviderException('Provider does not provide any endpoint URLs.'); + throw new \InvalidArgumentException('oEmbed endpoint must have a URL'); } $this->url = $url; + $this->provider = $provider; $this->schemes = $schemes; $this->formats = $formats; $this->supportsDiscovery = $supports_discovery; @@ -62,7 +74,7 @@ public function __construct($url, array $schemes = [], array $formats = [], $sup /** * Returns the endpoint's URL. * - * The URL will be build with the first defined format. If the endpoint + * The URL will be built with the first defined format. If the endpoint * doesn't provide a format, the JSON format will be used. * * @return string @@ -70,12 +82,22 @@ public function __construct($url, array $schemes = [], array $formats = [], $sup */ public function getUrl() { $format = 'json'; - if (!empty($this->getFormats()) && is_array($this->getFormats())) { + if (!empty($this->formats) && is_array($this->formats)) { $format = reset($this->getFormats()); } return str_replace('{format}', $format, $this->url); } + /** + * Returns the provider this endpoint belongs to. + * + * @return \Drupal\media\OEmbed\Provider + * The provider object. + */ + public function getProvider() { + return $this->provider; + } + /** * Returns list of URL schemes supported by the provider. * @@ -106,4 +128,24 @@ public function supportsDiscovery() { return $this->supportsDiscovery; } + /** + * Tries to match an URL against the endpoint schemes. + * + * @param string $url + * Media item URL. + * + * @return bool + * TRUE wether URL matches against the endpoint schemes, otherwise FALSE. + */ + public function matchUrl($url) { + foreach ($this->getSchemes() as $scheme) { + // Convert scheme into a valid regular expression. + $regexp = str_replace(['.', '*'], ['\.', '.*'], $scheme); + if (preg_match("|$regexp|", $url)) { + return TRUE; + } + } + return FALSE; + } + } diff --git a/core/modules/media/src/OEmbed/Provider.php b/core/modules/media/src/OEmbed/Provider.php index 89dfeefa81..7317eb3984 100644 --- a/core/modules/media/src/OEmbed/Provider.php +++ b/core/modules/media/src/OEmbed/Provider.php @@ -28,7 +28,7 @@ class Provider { * * @var \Drupal\media\OEmbed\Endpoint[] */ - protected $endpoints; + protected $endpoints = []; /** * Provider constructor. @@ -37,7 +37,7 @@ class Provider { * The provider name. * @param string $url * The provider $url. - * @param \Drupal\media\OEmbed\Endpoint[] $endpoints + * @param string[] $endpoints * List of endpoints this provider exposes. * * @throws \Drupal\media\OEmbed\ProviderException @@ -46,9 +46,16 @@ public function __construct($name, $url, array $endpoints) { if (empty($endpoints)) { throw new ProviderException('Provider @name does not define any endpoints.', $this); } + + foreach ($endpoints as $endpoint) { + $formats = !empty($endpoint['formats']) ? $endpoint['formats'] : []; + $schemes = !empty($endpoint['schemes']) ? $endpoint['schemes'] : []; + $discovery = !empty($endpoint['discovery']) ? $endpoint['discovery'] : []; + $this->endpoints[] = new Endpoint($endpoint['url'], $this, $schemes, $formats, $discovery); + } + $this->name = $name; $this->url = $url; - $this->endpoints = $endpoints; } /** @@ -92,9 +99,8 @@ public function getEndpoints() { */ public function buildResourceUrl($url) { $query = ['url' => $url]; - foreach ($this->getEndpoints() as $endpoint) { - return $endpoint->getUrl() . '?' . UrlHelper::buildQuery($query); - } + $endpoint = reset($this->endpoints); + return $endpoint->getUrl() . '?' . UrlHelper::buildQuery($query); } } diff --git a/core/modules/media/src/OEmbed/ProviderDiscovery.php b/core/modules/media/src/OEmbed/ProviderDiscovery.php index 53dc8ec561..5dafe41cec 100644 --- a/core/modules/media/src/OEmbed/ProviderDiscovery.php +++ b/core/modules/media/src/OEmbed/ProviderDiscovery.php @@ -16,6 +16,8 @@ class ProviderDiscovery implements ProviderDiscoveryInterface { /** * Cache provider list for a week. + * + * @var int */ const CACHE_LIFETIME = 604800; @@ -93,14 +95,7 @@ public function getAll() { $keyed_providers = []; foreach ($providers as $provider) { $name = $provider['provider_name']; - $endpoints = []; - foreach ($provider['endpoints'] as $endpoint) { - $formats = !empty($endpoint['formats']) ? $endpoint['formats'] : []; - $schemes = !empty($endpoint['schemes']) ? $endpoint['schemes'] : []; - $discovery = !empty($endpoint['discovery']) ? $endpoint['discovery'] : []; - $endpoints[] = new Endpoint($endpoint['url'], $schemes, $formats, $discovery); - } - $keyed_providers[$name] = new Provider($provider['provider_name'], $provider['provider_url'], $endpoints); + $keyed_providers[$name] = new Provider($provider['provider_name'], $provider['provider_url'], $provider['endpoints']); } $this->cacheBackend->set($cache_id, $keyed_providers, $this->time->getCurrentTime() + static::CACHE_LIFETIME); @@ -139,12 +134,8 @@ public function getProviderByUrl($url) { if (empty($endpoint->getSchemes())) { continue; } - foreach ($endpoint->getSchemes() as $scheme) { - // Convert scheme into a valid regular expression. - $regexp = str_replace(['.', '*'], ['\.', '.*'], $scheme); - if (preg_match("|$regexp|", $url)) { - return $provider_info; - } + if ($endpoint->matchUrl($url)) { + return $provider_info; } } } diff --git a/core/modules/media/src/OEmbed/ProviderDiscoveryInterface.php b/core/modules/media/src/OEmbed/ProviderDiscoveryInterface.php index 704f4865d3..10cbe52e3e 100644 --- a/core/modules/media/src/OEmbed/ProviderDiscoveryInterface.php +++ b/core/modules/media/src/OEmbed/ProviderDiscoveryInterface.php @@ -10,10 +10,9 @@ /** * Gets oEmbed providers information. * - * Returns a multi-dimensional array where each provider is represented as a - * single top-level array element. Each individual element is keyed by the - * provider's name, and has the values like in - * Drupal\media\OEmbed\ProviderDiscoveryInterface::get(). + * Returns an array where each provider is represented as a provider object + * element. Each individual element is keyed by the provider's name, and has + * the values like in Drupal\media\OEmbed\ProviderDiscoveryInterface::get(). * * @return \Drupal\media\OEmbed\Provider[] * Information about oEmbed providers. diff --git a/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php b/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php index 948437cdbd..6921ec2ed6 100644 --- a/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php +++ b/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php @@ -118,11 +118,6 @@ public function viewElements(FieldItemListInterface $items, $langcode) { continue; } - if (empty($resource['type'])) { - $this->messenger->addError($this->t("oEmbed type couldn't be identified.")); - return $element; - } - switch ($resource['type']) { case 'link': $element[$delta] = [ @@ -150,7 +145,8 @@ public function viewElements(FieldItemListInterface $items, $langcode) { break; default: - throw new \UnexpectedValueException(sprintf('Unknown oEmbed resource type "%s"', $resource['type'])); + $this->messenger->addError($this->t("Unknown oEmbed resource type @type", ['@type' => $resource['type']])); + } } diff --git a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedProviderConstraintValidator.php b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedProviderConstraintValidator.php index f0e6c89870..021baf00c7 100644 --- a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedProviderConstraintValidator.php +++ b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedProviderConstraintValidator.php @@ -62,8 +62,7 @@ public static function create(ContainerInterface $container) { public function validate($value, Constraint $constraint) { /** @var \Drupal\media\MediaInterface $media */ $media = $value->getEntity(); - $main_property = $value->getFieldDefinition()->getFieldStorageDefinition()->getMainPropertyName(); - $url = $value->first()->get($main_property)->getString(); + $url = $media->getSource()->getSourceFieldValue($media); try { $provider = $this->providerDiscovery->getProviderByUrl($url); diff --git a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php index 63f7f3d141..2b3d477f81 100644 --- a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php +++ b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php @@ -42,8 +42,9 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function validate($value, Constraint $constraint) { - $main_property = $value->getFieldDefinition()->getFieldStorageDefinition()->getMainPropertyName(); - $url = $value->first()->get($main_property)->getString(); + /** @var \Drupal\media\MediaInterface $media */ + $media = $value->getEntity(); + $url = $media->getSource()->getSourceFieldValue($media); try { $this->resourceFetcher->getResourceUrl($url); diff --git a/core/modules/media/src/Plugin/media/Source/OEmbed.php b/core/modules/media/src/Plugin/media/Source/OEmbed.php index c75fbd3a66..0a63287c5a 100644 --- a/core/modules/media/src/Plugin/media/Source/OEmbed.php +++ b/core/modules/media/src/Plugin/media/Source/OEmbed.php @@ -2,6 +2,7 @@ namespace Drupal\media\Plugin\media\Source; +use Drupal\Component\Transliteration\TransliterationInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\Display\EntityFormDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; @@ -11,12 +12,9 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Messenger\MessengerInterface; -use Drupal\link\LinkItemInterface; -use Drupal\media\OEmbed\ProviderException; use Drupal\media\OEmbed\ResourceException; use Drupal\media\MediaSourceBase; use Drupal\media\MediaInterface; -use Drupal\media\MediaSourceFieldConstraintsInterface; use Drupal\media\MediaTypeInterface; use Drupal\media\OEmbed\ResourceFetcherInterface; use Drupal\media\OEmbed\ProviderDiscoveryInterface; @@ -34,7 +32,7 @@ * deriver = "Drupal\media\Plugin\media\Source\OEmbedDeriver" * ) */ -class OEmbed extends MediaSourceBase implements MediaSourceFieldConstraintsInterface { +class OEmbed extends MediaSourceBase implements OEmbedInterface { /** * The logger channel for media. @@ -50,6 +48,13 @@ class OEmbed extends MediaSourceBase implements MediaSourceFieldConstraintsInter */ protected $messenger; + /** + * The transliteration service. + * + * @var \Drupal\Component\Transliteration\TransliterationInterface + */ + protected $transliteration; + /** * The oEmbed resource fetcher service. * @@ -85,15 +90,18 @@ class OEmbed extends MediaSourceBase implements MediaSourceFieldConstraintsInter * The logger channel for media. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The messenger service. + * @param \Drupal\Component\Transliteration\TransliterationInterface $transliteration + * The transliteration service. * @param \Drupal\media\OEmbed\ResourceFetcherInterface $resource_fetcher * The oEmbed resource fetcher service. * @param \Drupal\media\OEmbed\ProviderDiscoveryInterface $provider_discovery * The oEmbed provider discovery service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_manager, LoggerChannelInterface $logger, MessengerInterface $messenger, ResourceFetcherInterface $resource_fetcher, ProviderDiscoveryInterface $provider_discovery) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_manager, LoggerChannelInterface $logger, MessengerInterface $messenger, TransliterationInterface $transliteration, ResourceFetcherInterface $resource_fetcher, ProviderDiscoveryInterface $provider_discovery) { parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_field_manager, $field_type_manager, $config_factory); $this->logger = $logger; $this->messenger = $messenger; + $this->transliteration = $transliteration; $this->resourceFetcher = $resource_fetcher; $this->providerDiscovery = $provider_discovery; } @@ -112,6 +120,7 @@ public static function create(ContainerInterface $container, array $configuratio $container->get('plugin.manager.field.field_type'), $container->get('logger.factory')->get('media'), $container->get('messenger'), + $container->get('transliteration'), $container->get('media.oembed.resource_fetcher'), $container->get('media.oembed.provider_discovery') ); @@ -126,6 +135,7 @@ public function getMetadataAttributes() { 'title' => $this->t('Resource title'), 'author_name' => $this->t('The name of the author/owner'), 'author_url' => $this->t('The URL of the author/owner'), + 'provider_id' => $this->t("The provider's ID"), 'provider_name' => $this->t("The provider's name"), 'provider_url' => $this->t('The URL of the provider'), 'cache_age' => $this->t('Suggested cache lifetime'), @@ -191,6 +201,10 @@ public function getMetadata(MediaInterface $media, $name) { } return parent::getMetadata($media, 'thumbnail_uri'); + case 'provider_id': + $provider_name = $this->getMetadata($media, 'provider_name'); + return $this->transliteration->transliterate($provider_name); + default: if (!empty($resource[$name])) { return $resource[$name]; @@ -313,4 +327,22 @@ public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayIn $display->removeComponent('name'); } + /** + * {@inheritdoc} + */ + public function getAllowedProviders() { + $allowed_providers = $this->getSupportedProviders(); + if (!empty($this->configuration['allowed_providers'])) { + $allowed_providers = $this->configuration['allowed_providers']; + } + return $allowed_providers; + } + + /** + * {@inheritdoc} + */ + public function getSupportedProviders() { + return $this->pluginDefinition['supported_providers']; + } + } diff --git a/core/modules/media/src/Plugin/media/Source/OEmbedDeriver.php b/core/modules/media/src/Plugin/media/Source/OEmbedDeriver.php index d7a07a9f76..fb396d19e7 100644 --- a/core/modules/media/src/Plugin/media/Source/OEmbedDeriver.php +++ b/core/modules/media/src/Plugin/media/Source/OEmbedDeriver.php @@ -13,10 +13,9 @@ class OEmbedDeriver extends DeriverBase { * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { - $this->derivatives = [ - 'remote_video' => [ - 'id' => 'remote_video', + 'video' => [ + 'id' => 'video', 'label' => t('Remote video'), 'description' => t('Use remote video URL for reusable media.'), 'supported_providers' => ['YouTube', 'Vimeo'], @@ -24,7 +23,6 @@ public function getDerivativeDefinitions($base_plugin_definition) { 'default_thumbnail_filename' => 'video.png', ] + $base_plugin_definition, ]; - return parent::getDerivativeDefinitions($base_plugin_definition); } diff --git a/core/modules/media/src/Plugin/media/Source/OEmbedInterface.php b/core/modules/media/src/Plugin/media/Source/OEmbedInterface.php new file mode 100644 index 0000000000..c7f7343cdd --- /dev/null +++ b/core/modules/media/src/Plugin/media/Source/OEmbedInterface.php @@ -0,0 +1,28 @@ +getPage(); $assert_session = $this->assertSession(); - $this->doTestCreateMediaType($media_type_id, 'oembed:remote_video', $provided_fields); + $this->doTestCreateMediaType($media_type_id, 'oembed:video', $provided_fields); // Create custom fields for the media type to store metadata attributes. $fields = [ diff --git a/core/profiles/standard/config/optional/core.entity_form_display.media.remote_video.default.yml b/core/profiles/standard/config/optional/core.entity_form_display.media.remote_video.default.yml index 657373cd36..d6a50b04c3 100644 --- a/core/profiles/standard/config/optional/core.entity_form_display.media.remote_video.default.yml +++ b/core/profiles/standard/config/optional/core.entity_form_display.media.remote_video.default.yml @@ -2,7 +2,7 @@ langcode: en status: true dependencies: config: - - field.field.media.remote_video.field_media_oembed_remote_video + - field.field.media.remote_video.field_media_oembed_video - media.type.remote_video id: media.remote_video.default targetEntityType: media @@ -15,7 +15,7 @@ content: region: content settings: { } third_party_settings: { } - field_media_oembed_remote_video: + field_media_oembed_video: settings: size: 60 placeholder: '' diff --git a/core/profiles/standard/config/optional/core.entity_view_display.media.remote_video.default.yml b/core/profiles/standard/config/optional/core.entity_view_display.media.remote_video.default.yml index 8e35beb4d4..ce4cc68477 100644 --- a/core/profiles/standard/config/optional/core.entity_view_display.media.remote_video.default.yml +++ b/core/profiles/standard/config/optional/core.entity_view_display.media.remote_video.default.yml @@ -2,7 +2,7 @@ langcode: en status: true dependencies: config: - - field.field.media.remote_video.field_media_oembed_remote_video + - field.field.media.remote_video.field_media_oembed_video - image.style.thumbnail - media.type.remote_video module: @@ -14,7 +14,7 @@ targetEntityType: media bundle: remote_video mode: default content: - field_media_oembed_remote_video: + field_media_oembed_video: label: hidden settings: max_width: 0 diff --git a/core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_remote_video.yml b/core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_video.yml similarity index 63% rename from core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_remote_video.yml rename to core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_video.yml index 2743bd19b2..bdb13c62aa 100644 --- a/core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_remote_video.yml +++ b/core/profiles/standard/config/optional/field.field.media.remote_video.field_media_oembed_video.yml @@ -2,10 +2,10 @@ langcode: en status: true dependencies: config: - - field.storage.media.field_media_oembed_remote_video + - field.storage.media.field_media_oembed_video - media.type.remote_video -id: media.remote_video.field_media_oembed_remote_video -field_name: field_media_oembed_remote_video +id: media.remote_video.field_media_oembed_video +field_name: field_media_oembed_video entity_type: media bundle: remote_video label: Remote Video URL diff --git a/core/profiles/standard/config/optional/field.storage.media.field_media_oembed_remote_video.yml b/core/profiles/standard/config/optional/field.storage.media.field_media_oembed_video.yml similarity index 77% rename from core/profiles/standard/config/optional/field.storage.media.field_media_oembed_remote_video.yml rename to core/profiles/standard/config/optional/field.storage.media.field_media_oembed_video.yml index 01a234047f..7485f1a6d2 100644 --- a/core/profiles/standard/config/optional/field.storage.media.field_media_oembed_remote_video.yml +++ b/core/profiles/standard/config/optional/field.storage.media.field_media_oembed_video.yml @@ -3,8 +3,8 @@ status: true dependencies: module: - media -id: media.field_media_oembed_remote_video -field_name: field_media_oembed_remote_video +id: media.field_media_oembed_video +field_name: field_media_oembed_video entity_type: media type: string settings: diff --git a/core/profiles/standard/config/optional/media.type.remote_video.yml b/core/profiles/standard/config/optional/media.type.remote_video.yml index df9b160057..44b5f76db7 100644 --- a/core/profiles/standard/config/optional/media.type.remote_video.yml +++ b/core/profiles/standard/config/optional/media.type.remote_video.yml @@ -4,10 +4,10 @@ dependencies: { } id: remote_video label: "Remote Video" description: "Use this media type to store remote content such as YouTube videos." -source: oembed:remote_video +source: oembed:video queue_thumbnail_downloads: false new_revision: true source_configuration: thumbnails_location: 'public://oembed_thumbnails' - source_field: field_media_oembed_remote_video + source_field: field_media_oembed_video field_map: { }