public function Image::createSourceField in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
- 10 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
Creates the source field definition for a type.
Parameters
\Drupal\media\MediaTypeInterface $type: The media type.
Return value
\Drupal\field\FieldConfigInterface The unsaved field definition. The field storage definition, if new, should also be unsaved.
Overrides File::createSourceField
File
- core/
modules/ media/ src/ Plugin/ media/ Source/ Image.php, line 154
Class
- Image
- Image entity media source.
Namespace
Drupal\media\Plugin\media\SourceCode
public function createSourceField(MediaTypeInterface $type) {
/** @var \Drupal\field\FieldConfigInterface $field */
$field = parent::createSourceField($type);
// Reset the field to its default settings so that we don't inherit the
// settings from the parent class' source field.
$settings = $this->fieldTypeManager
->getDefaultFieldSettings($field
->getType());
return $field
->set('settings', $settings);
}