From 91016fd2379ac3cd6a0517c8331909603e0a0808 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 6 Jul 2023 14:51:23 -0300 Subject: [PATCH] Don't delete files in the thumbnail field. --- src/Form/ConfirmDeleteMediaAndFile.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Form/ConfirmDeleteMediaAndFile.php b/src/Form/ConfirmDeleteMediaAndFile.php index d5dc9750..a9613871 100644 --- a/src/Form/ConfirmDeleteMediaAndFile.php +++ b/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;