You are here

public function OEmbed::createSourceField in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::createSourceField()
  2. 9 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::createSourceField()

Creates the source field definition for a type.

Parameters

\Drupal\media\MediaTypeInterface $type: The media type.

Return value

\Drupal\field\FieldConfigInterface The unsaved field definition. The field storage definition, if new, should also be unsaved.

Overrides MediaSourceBase::createSourceField

File

core/modules/media/src/Plugin/media/Source/OEmbed.php, line 536

Class

OEmbed
Provides a media source plugin for oEmbed resources.

Namespace

Drupal\media\Plugin\media\Source

Code

public function createSourceField(MediaTypeInterface $type) {
  $plugin_definition = $this
    ->getPluginDefinition();
  $label = (string) $this
    ->t('@type URL', [
    '@type' => $plugin_definition['label'],
  ]);
  return parent::createSourceField($type)
    ->set('label', $label);
}