function MediaSourceBase::createSourceFieldStorage

Same name in other branches
  1. 9 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceFieldStorage()
  2. 8.9.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceFieldStorage()
  3. 10 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']),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.