You are here

public function File::createSourceField in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/src/Plugin/media/Source/File.php \Drupal\media\Plugin\media\Source\File::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 MediaSourceBase::createSourceField

1 call to File::createSourceField()
Image::createSourceField in core/modules/media/src/Plugin/media/Source/Image.php
Creates the source field definition for a type.
3 methods override File::createSourceField()
AudioFile::createSourceField in core/modules/media/src/Plugin/media/Source/AudioFile.php
Creates the source field definition for a type.
Image::createSourceField in core/modules/media/src/Plugin/media/Source/Image.php
Creates the source field definition for a type.
VideoFile::createSourceField in core/modules/media/src/Plugin/media/Source/VideoFile.php
Creates the source field definition for a type.

File

core/modules/media/src/Plugin/media/Source/File.php, line 123

Class

File
File entity media source.

Namespace

Drupal\media\Plugin\media\Source

Code

public function createSourceField(MediaTypeInterface $type) {
  return parent::createSourceField($type)
    ->set('settings', [
    'file_extensions' => 'txt doc docx pdf',
  ]);
}