Remove an attachment as preview image of an element, if it is not an image anymore through a change

This commit is contained in:
Jan Böhmer 2023-11-27 22:59:02 +01:00
parent 08bd4d54e3
commit dbff543fa8
2 changed files with 18 additions and 8 deletions

View file

@ -75,7 +75,8 @@ class StructuralEntityChoiceHelper
}
if ($choice instanceof HasMasterAttachmentInterface) {
$tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof Attachment ?
$tmp['data-image'] = ($choice->getMasterPictureAttachment() instanceof Attachment
&& $choice->getMasterPictureAttachment()->isPicture()) ?
$this->attachmentURLGenerator->getThumbnailURL($choice->getMasterPictureAttachment(),
'thumbnail_xs')
: null