Browse Source

Don't delete files in the thumbnail field.

pull/960/head
Rosie Le Faive 1 year ago
parent
commit
91016fd237
  1. 3
      src/Form/ConfirmDeleteMediaAndFile.php

3
src/Form/ConfirmDeleteMediaAndFile.php

@ -128,6 +128,9 @@ class ConfirmDeleteMediaAndFile extends DeleteMultipleForm {
// Check for files.
$fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle());
foreach ($fields as $field) {
if ($field->getName() == 'thumbnail') {
continue;
}
$type = $field->getType();
if ($type == 'file' || $type == 'image') {
$target_id = $entity->get($field->getName())->target_id;

Loading…
Cancel
Save