You are here

protected function Document::createSourceField in Media entity document 8

File

src/Plugin/MediaEntity/Type/Document.php, line 115

Class

Document
Provides media type plugin for Document.

Namespace

Drupal\media_entity_document\Plugin\MediaEntity\Type

Code

protected function createSourceField(MediaBundleInterface $bundle) {
  return $this->entityTypeManager
    ->getStorage('field_config')
    ->create([
    'field_storage' => $this
      ->getSourceFieldStorage(),
    'bundle' => $bundle
      ->id(),
    'required' => TRUE,
    'label' => $this
      ->t('Source file'),
  ]);
}