function MediaSourceBase::getSourceFieldStorage
Same name in other branches
- 8.9.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::getSourceFieldStorage()
- 10 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::getSourceFieldStorage()
- 11.x 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\mediaCode
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 $fields[$field] ?? NULL;
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.