From fd71c454ecf2e05225f27e0d3b060d7b5ff485b4 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 18 Mar 2024 14:20:59 +0100 Subject: [PATCH] IBX-7954: Show error message on empty image asset --- .../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..2fcc436471 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js @@ -126,6 +126,18 @@ * @param {Object} image */ updateData(destinationContentId, destinationContentName, destinationLocationId, image) { + if (image === null) { + showErrorNotification( + Translator.trans( + /* @Desc("The chosen asset has no image data available.") */ 'ezimageasset.empty_data.message.error', + {}, + 'fieldtypes_preview' + ) + ); + + return; + } + const preview = this.fieldContainer.querySelector('.ez-field-edit__preview'); const previewVisual = preview.querySelector('.ez-field-edit-preview__visual'); const previewImg = preview.querySelector('.ez-field-edit-preview__media'); 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