public function FileSelection::createNewEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/src/Plugin/EntityReferenceSelection/FileSelection.php \Drupal\file\Plugin\EntityReferenceSelection\FileSelection::createNewEntity()
- 9 core/modules/file/src/Plugin/EntityReferenceSelection/FileSelection.php \Drupal\file\Plugin\EntityReferenceSelection\FileSelection::createNewEntity()
File
- core/modules/ file/ src/ Plugin/ EntityReferenceSelection/ FileSelection.php, line 40 
Class
- FileSelection
- Provides specific access control for the file entity type.
Namespace
Drupal\file\Plugin\EntityReferenceSelectionCode
public function createNewEntity($entity_type_id, $bundle, $label, $uid) {
  $file = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
  // In order to create a referenceable file, it needs to have a "permanent"
  // status.
  /** @var \Drupal\file\FileInterface $file */
  $file
    ->setPermanent();
  return $file;
}