From eda485e93a09e8d838723b4508667108c8757af3 Mon Sep 17 00:00:00 2001 From: Nicolas AMBROISE Date: Mon, 6 May 2024 10:32:10 +0200 Subject: [PATCH] Add lang on image --- .../wcm/core/components/internal/models/v2/ImageImpl.java | 4 ++++ .../apps/core/wcm/components/image/v3/image/image.html | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java index 83d970e7ef..7bc45974ff 100755 --- a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java +++ b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java @@ -153,6 +153,7 @@ protected void initModel() { super.initModel(); boolean altValueFromDAM = properties.get(PN_ALT_VALUE_FROM_DAM, currentStyle.get(PN_ALT_VALUE_FROM_DAM, true)); boolean titleValueFromDAM = properties.get(PN_TITLE_VALUE_FROM_DAM, currentStyle.get(PN_TITLE_VALUE_FROM_DAM, true)); + boolean langValueFromDAM = properties.get(PN_LANG_VALUE_FROM_DAM, currentStyle.get(PN_LANG_VALUE_FROM_DAM, true)); boolean isDmFeaturesEnabled = currentStyle.get(PN_DESIGN_DYNAMIC_MEDIA_ENABLED, false); displayPopupTitle = properties.get(PN_DISPLAY_POPUP_TITLE, currentStyle.get(PN_DISPLAY_POPUP_TITLE, true)); boolean uuidDisabled = currentStyle.get(PN_UUID_DISABLED, false); @@ -182,6 +183,9 @@ protected void initModel() { if (titleValueFromDAM) { title = StringUtils.trimToNull(asset.getMetadataValue(DamConstants.DC_TITLE)); } + if (langValueFromDAM) { + lang = asset.getMetadataValue(DamConstants.DC_LANGUAGE); + } //check "Enable DM features" checkbox //check DM asset - check for "dam:scene7File" metadata value diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/image.html b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/image.html index cd9de21ffa..645646ee59 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/image.html +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/image.html @@ -28,6 +28,7 @@ data-cmp-hook-image="imageV3" class="cmp-image${!wcmmode.disabled ? ' cq-dd-image' : ''}" itemscope itemtype="http://schema.org/ImageObject"> + + alt="${image.alt || true}" + title="${image.displayPopupTitle && image.title}" + lang="${image.lang && image.lang != contentLang ? image.lang : ''}"/> ${image.title}