From 2ffae96323975dd491fafef5b63e95ee118b2ef2 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Tue, 26 Mar 2024 13:49:39 +0100 Subject: [PATCH] IBX-7954: Show error message on empty image asset (#2116) --- .../public/js/scripts/fieldType/ezimageasset.js | 12 ++++++++++++ .../translations/fieldtypes_preview.en.xliff | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js index fa872ee786..7c1d583098 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js @@ -98,6 +98,18 @@ return field.fieldDefinitionIdentifier === imageAssetMapping['contentFieldIdentifier']; }); + if (imageField.fieldValue === null) { + showErrorNotification( + Translator.trans( + /* @Desc("The chosen asset has no image data available.") */ 'ezimageasset.empty_data.message.error', + {}, + 'fieldtypes_preview' + ) + ); + + return; + } + this.updateData( response.ContentInfo.Content._id, response.ContentInfo.Content.TranslatedName, diff --git a/src/bundle/Resources/translations/fieldtypes_preview.en.xliff b/src/bundle/Resources/translations/fieldtypes_preview.en.xliff index c6e0cdd480..4d4f7a97ae 100644 --- a/src/bundle/Resources/translations/fieldtypes_preview.en.xliff +++ b/src/bundle/Resources/translations/fieldtypes_preview.en.xliff @@ -81,6 +81,11 @@ Alternative text key: ezimageasset.alternative_text + + The chosen asset has no image data available. + The chosen asset has no image data available. + key: ezimageasset.empty_data.message.error + File name File name