diff --git a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java
index 408ffc5357..31f8f632db 100644
--- a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java
+++ b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/Utils.java
@@ -25,6 +25,7 @@
import java.util.Optional;
import java.util.Set;
+import com.adobe.cq.wcm.core.components.models.Image;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
@@ -344,9 +345,10 @@ public static Resource getWrappedImageResourceWithInheritance(Resource resource,
String fileReference = properties.get(DownloadResource.PN_REFERENCE, String.class);
Resource fileResource = resource.getChild(DownloadResource.NN_FILE);
boolean imageFromPageImage = properties.get(PN_IMAGE_FROM_PAGE_IMAGE, StringUtils.isEmpty(fileReference) && fileResource == null);
+ boolean disablePageImageInheritance = currentStyle != null ? currentStyle.get(Image.PN_PAGE_IMAGE_INHERITANCE_DISABLED, false) : false;
boolean altValueFromPageImage = properties.get(PN_ALT_VALUE_FROM_PAGE_IMAGE, imageFromPageImage);
- if (imageFromPageImage) {
+ if (!disablePageImageInheritance && imageFromPageImage) {
Resource inheritedResource = null;
String linkURL = properties.get(ImageResource.PN_LINK_URL, String.class);
boolean actionsEnabled = (currentStyle != null) ?
diff --git a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/models/Image.java b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/models/Image.java
index eda135f923..0d4f07a5a1 100644
--- a/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/models/Image.java
+++ b/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/models/Image.java
@@ -40,6 +40,13 @@ public interface Image extends Component {
*/
String PN_IMAGE_FROM_PAGE_IMAGE = "imageFromPageImage";
+ /**
+ * Name of the content policy property that will indicate if the image inheritance the featured image of the page is disabled.
+ *
+ * @since com.adobe.cq.wcm.core.components.models 12.29.0
+ */
+ String PN_PAGE_IMAGE_INHERITANCE_DISABLED = "disablePageImageInheritance";
+
/**
* Name of the resource property that will indicate if the value of the {@code alt} attribute should be inherited
* from the featured image of the page.
diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/_cq_design_dialog/.content.xml b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/_cq_design_dialog/.content.xml
index 6d1a2e9fd3..04a4af6232 100644
--- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/_cq_design_dialog/.content.xml
+++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/_cq_design_dialog/.content.xml
@@ -76,6 +76,15 @@
checked="{Boolean}false"
uncheckedValue="false"
value="{Boolean}true"/>
+
() {{
- put("clientlibs", clientlibs);
+ put("clientlibs", clientlibs);
}});
// 4.
@@ -91,8 +91,8 @@ public void setup(CQClient client, String contextPath, String label, String imag
// 6.
compPath = Commons.addComponentWithRetry(client, proxyPath,testPage + Commons.relParentCompPath, "image", null,
- RequestConstants.TIMEOUT_TIME_MS, RequestConstants.RETRY_TIME_INTERVAL,
- HttpStatus.SC_OK, HttpStatus.SC_CREATED);
+ RequestConstants.TIMEOUT_TIME_MS, RequestConstants.RETRY_TIME_INTERVAL,
+ HttpStatus.SC_OK, HttpStatus.SC_CREATED);
// 7.
editorPage = new PageEditorPage(testPage);
@@ -106,8 +106,8 @@ public void setup(CQClient client, String contextPath, String label, String imag
public void cleanup(CQClient client) throws ClientException, InterruptedException {
client.deletePageWithRetry(testPage, true,false,
- RequestConstants.TIMEOUT_TIME_MS, RequestConstants.RETRY_TIME_INTERVAL,
- HttpStatus.SC_OK);
+ RequestConstants.TIMEOUT_TIME_MS, RequestConstants.RETRY_TIME_INTERVAL,
+ HttpStatus.SC_OK);
}
public void setMinimalProps() throws InterruptedException, TimeoutException {
@@ -183,7 +183,7 @@ public void testAddImage() throws TimeoutException, InterruptedException {
Commons.closeSidePanel();
Commons.switchContext("ContentFrame");
assertTrue(image.isImagePresentWithAltTextAndTitle(testPage, originalDamDescription, originalDamTitle), "Image should be present with alt text " + originalDamDescription
- + " and title " + originalDamTitle);
+ + " and title " + originalDamTitle);
}
public void testDragImageToComponent(boolean imageV3) throws TimeoutException, InterruptedException {
@@ -221,7 +221,7 @@ public void testAddAltTextAndTitle() throws TimeoutException, InterruptedExcepti
Commons.closeSidePanel();
Commons.switchContext("ContentFrame");
assertTrue(image.isImagePresentWithAltTextAndTitle(testPage, altText, captionText), "Image should be present with alt text " + altText
- + " and title " + captionText);
+ + " and title " + captionText);
}
public void testSetAssetWithoutDescriptionAsDecorative(boolean imageV3) throws InterruptedException, TimeoutException {
@@ -243,7 +243,7 @@ public void testSetAssetWithoutDescription() throws InterruptedException, Timeou
editDialog.openMetadataTab();
Commons.saveConfigureDialog();
String assetWithoutDescriptionErrorMessageSelector = ".coral-Form-errorlabel, " +
- "coral-tooltip[variant='error'] > coral-tooltip-content";
+ "coral-tooltip[variant='error'] > coral-tooltip-content";
assertEquals("Error: Please provide an asset which has a description that can be used as alt text.", $(assetWithoutDescriptionErrorMessageSelector).innerText());
}
@@ -252,7 +252,7 @@ public void testSetAssetWithoutDescriptionV3() throws InterruptedException, Time
dragImageWithoutDescription();
Commons.saveConfigureDialog();
String assetWithoutDescriptionErrorMessageSelector = ".coral-Form-errorlabel, " +
- "coral-tooltip[variant='error'] > coral-tooltip-content";
+ "coral-tooltip[variant='error'] > coral-tooltip-content";
String errorIcon = "input[name='./alt'] + coral-icon[icon='alert']";
final WebDriver webDriver = WebDriverRunner.getWebDriver();
((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", $(errorIcon));
@@ -272,7 +272,7 @@ public void testAddAltTextAndTitleV3() throws TimeoutException, InterruptedExcep
Commons.closeSidePanel();
Commons.switchContext("ContentFrame");
assertTrue(image.isImagePresentWithAltTextAndTitle(testPage, altText, captionText), "Image should be present with alt text " + altText
- + " and title " + captionText);
+ + " and title " + captionText);
}
public void testDisableCaptionAsPopup() throws TimeoutException, InterruptedException {
@@ -402,7 +402,7 @@ public void testSetSizes() throws TimeoutException, InterruptedException {
editorPage.enterPreviewMode();
Commons.switchContext("ContentFrame");
assertTrue(image.isImagePresentWithSizes(testPage, "(min-width: 36em) 33.3vw, 100vw"), "Image with sizes attribute should be " +
- "present");
+ "present");
}
public void testPageImageWithEmptyAltTextFromPageImage(boolean aem65) throws InterruptedException, ClientException {
@@ -484,6 +484,18 @@ public void testPageImageWithLinkedPage(boolean aem65) throws TimeoutException,
assertTrue(Commons.getCurrentUrl().endsWith(redirectPage+".html"),"Current page should be link URL set after redirection");
}
+ public void testPageImageWithFeaturedImageDisabled(boolean aem65) throws TimeoutException, InterruptedException, ClientException {
+ setPageImage(aem65, testPage, logoNodeName, true);
+ editorPage.open();
+ ImageEditDialog editDialog = image.getEditDialog();
+ Commons.openEditDialog(editorPage, compPath);
+ editDialog.openMetadataTab();
+ Commons.saveConfigureDialog();
+ editorPage.enterPreviewMode();
+ Commons.switchContext("ContentFrame");
+ assertFalse(image.isImagePresentWithFileName(climbingAssetFormatted),"image should not be rendered, page featured image inheritance is disabled");
+ }
+
public void testSetLinkWithTarget() throws TimeoutException, InterruptedException {
Commons.openSidePanel();
dragImage();
diff --git a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java
index 5e4c433607..3559abcda2 100644
--- a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java
+++ b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java
@@ -225,6 +225,31 @@ public void testPageImageWithLinkedPage65() throws TimeoutException, Interrupted
imageTests.testPageImageWithLinkedPage(true);
}
+ /**
+ * Test: set page featured image with featured image disabled
+ */
+ @Tag("IgnoreOnSDK")
+ @Test
+ @DisplayName("Test (6.5): set page featured image with featured image disabled")
+ public void testPageImageWithFeaturedImageDisabled65() throws TimeoutException, InterruptedException, ClientException {
+ testPageImageWithFeaturedImageDisabled(true);
+ }
+
+ /**
+ * Test: set page featured image with featured image disabled
+ */
+ @Test
+ @DisplayName("Test: set page featured image with featured image disabled")
+ public void testPageImageWithFeaturedImageDisabledSdk() throws TimeoutException, InterruptedException, ClientException {
+ testPageImageWithFeaturedImageDisabled(false);
+ }
+
+ private void testPageImageWithFeaturedImageDisabled(boolean aem65) throws ClientException, TimeoutException, InterruptedException {
+ String policyPath = createComponentPolicy("/image-v3", new HashMap() {{ put("disablePageImageInheritance", "true"); }} );
+ imageTests.testPageImageWithFeaturedImageDisabled(aem65);
+ deleteComponentPolicy("/image-v3", policyPath);
+ }
+
/**
* Test: set link with target on image
*/