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. // Check for files.
$fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle()); $fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle());
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field->getName() == 'thumbnail') {
continue;
}
$type = $field->getType(); $type = $field->getType();
if ($type == 'file' || $type == 'image') { if ($type == 'file' || $type == 'image') {
$target_id = $entity->get($field->getName())->target_id; $target_id = $entity->get($field->getName())->target_id;

Loading…
Cancel
Save