You are here

protected function MediaSourceBase::createSourceFieldStorage in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceFieldStorage()

Creates the source field storage definition.

By default, the first field type listed in the plugin definition's allowed_field_types array will be the generated field's type.

Return value

\Drupal\field\FieldStorageConfigInterface The unsaved field storage definition.

2 calls to MediaSourceBase::createSourceFieldStorage()
MediaSourceBase::createSourceField in core/modules/media/src/MediaSourceBase.php
Creates the source field definition for a type.
MediaSourceBase::submitConfigurationForm in core/modules/media/src/MediaSourceBase.php
Form submission handler.

File

core/modules/media/src/MediaSourceBase.php, line 238

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

protected function createSourceFieldStorage() {
  return $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->create([
    'entity_type' => 'media',
    'field_name' => $this
      ->getSourceFieldName(),
    'type' => reset($this->pluginDefinition['allowed_field_types']),
  ]);
}