You are here

protected function MediaSourceBase::getSourceFieldStorage in Drupal 9

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

Returns the source field storage definition.

Return value

\Drupal\Core\Field\FieldStorageDefinitionInterface|null The field storage definition or NULL if it doesn't exists.

1 call to MediaSourceBase::getSourceFieldStorage()
MediaSourceBase::createSourceField in core/modules/media/src/MediaSourceBase.php
Creates the source field definition for a type.

File

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

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

protected function getSourceFieldStorage() {

  // Nothing to do if no source field is configured yet.
  $field = $this->configuration['source_field'];
  if ($field) {

    // Even if we do know the name of the source field, there's no
    // guarantee that it exists.
    $fields = $this->entityFieldManager
      ->getFieldStorageDefinitions('media');
    return isset($fields[$field]) ? $fields[$field] : NULL;
  }
  return NULL;
}