From 6111a7185cfdc2fec2256d7845ac83bef655d5ca Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Tue, 23 Jan 2024 17:26:18 +0100 Subject: [PATCH] set path/alt.text independently of DAM asset --- .../impl/models/wcmio/v1/ResponsiveImageV1Impl.java | 6 +++--- .../responsiveimage/v1/responsiveimage/responsiveimage.html | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/wcmio/v1/ResponsiveImageV1Impl.java b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/wcmio/v1/ResponsiveImageV1Impl.java index ea8b9b53..56a97a42 100644 --- a/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/wcmio/v1/ResponsiveImageV1Impl.java +++ b/bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/wcmio/v1/ResponsiveImageV1Impl.java @@ -152,14 +152,14 @@ private void activate() { private void initPropertiesFromDamAsset(ValueMap properties) { Asset asset = media.getAsset(); if (asset != null) { + fileReference = asset.getPath(); + alt = asset.getAltText(); + com.day.cq.dam.api.Asset damAsset = asset.adaptTo(com.day.cq.dam.api.Asset.class); if (damAsset != null) { boolean titleFromAsset = properties.get(PN_TITLE_VALUE_FROM_DAM, currentStyle.get(PN_TITLE_VALUE_FROM_DAM, true)); boolean uuidDisabled = currentStyle.get(PN_UUID_DISABLED, false); - fileReference = damAsset.getPath(); - alt = asset.getAltText(); - if (!uuidDisabled) { uuid = damAsset.getID(); } diff --git a/bundles/core/src/main/webapp/app-root/components/wcmio/responsiveimage/v1/responsiveimage/responsiveimage.html b/bundles/core/src/main/webapp/app-root/components/wcmio/responsiveimage/v1/responsiveimage/responsiveimage.html index 0ce440be..c9583f1a 100644 --- a/bundles/core/src/main/webapp/app-root/components/wcmio/responsiveimage/v1/responsiveimage/responsiveimage.html +++ b/bundles/core/src/main/webapp/app-root/components/wcmio/responsiveimage/v1/responsiveimage/responsiveimage.html @@ -3,6 +3,7 @@ data-cmp-is="wcmio-responsiveimage" data-asset="${image.fileReference}" data-asset-id="${image.uuid}" + data-cmp-filereference="${image.fileReference}" data-title="${image.title || image.alt}" id="${image.id}" data-cmp-data-layer="${image.data.json}"