function File::createSourceField

Same name in other branches
  1. 9 core/modules/media/src/Plugin/media/Source/File.php \Drupal\media\Plugin\media\Source\File::createSourceField()
  2. 8.9.x core/modules/media/src/Plugin/media/Source/File.php \Drupal\media\Plugin\media\Source\File::createSourceField()
  3. 10 core/modules/media/src/Plugin/media/Source/File.php \Drupal\media\Plugin\media\Source\File::createSourceField()

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',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.