diff --git a/core/modules/media_library/src/Form/AddFormBase.php b/core/modules/media_library/src/Form/AddFormBase.php index 45c1a8f0f4..27c17065f7 100644 --- a/core/modules/media_library/src/Form/AddFormBase.php +++ b/core/modules/media_library/src/Form/AddFormBase.php @@ -95,7 +95,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Med } $this->openerResolver = $opener_resolver; if (!$file_usage) { - @trigger_error('The file.usage service must be passed to AddFormBase::__construct(), it is required before Drupal 9.0.0.', E_USER_DEPRECATED); + @trigger_error('Calling AddFormBase::__construct() without the file.usage service is deprecated in drupal:8.8.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3075165', E_USER_DEPRECATED); $file_usage = \Drupal::service('file.usage'); } $this->fileUsage = $file_usage; @@ -576,7 +576,6 @@ public function removeButtonSubmit(array $form, FormStateInterface $form_state) $added_media = $form_state->get('media'); $removed_media = $added_media[$delta]; - // Immediately discard its file. $file = $removed_media->get($this->getSourceFieldName($removed_media->bundle->entity))->entity; if ($file instanceof FileInterface && empty($this->fileUsage->listUsage($file))) { $file->delete();