function MediaSourceBase::createSourceField
Same name in other branches
- 8.9.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceField()
- 10 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceField()
- 11.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::createSourceField()
Overrides MediaSourceInterface::createSourceField
2 methods override MediaSourceBase::createSourceField()
- File::createSourceField in core/
modules/ media/ src/ Plugin/ media/ Source/ File.php - OEmbed::createSourceField in core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php
File
-
core/
modules/ media/ src/ MediaSourceBase.php, line 284
Class
- MediaSourceBase
- Base implementation of media source plugin.
Namespace
Drupal\mediaCode
public function createSourceField(MediaTypeInterface $type) {
$storage = $this->getSourceFieldStorage() ?: $this->createSourceFieldStorage();
return $this->entityTypeManager
->getStorage('field_config')
->create([
'field_storage' => $storage,
'bundle' => $type->id(),
'label' => $this->pluginDefinition['label'],
'required' => TRUE,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.