adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
730 stars 736 forks source link

[Container] Export background colour and image in JSON model #1168

Open znikolovski opened 3 years ago

znikolovski commented 3 years ago

Feature Request

At the present the Container component doesn't expose the background colour and image values in the Sling Model as individual values. While this is not a problem when using the standard core components it can present challenges with SPA implementation where the container is implemented as a React/Angular component where these values will need to be made available.

At the moment, there seems to be a reference implementation that uses the backgroundStyle property here but that doesn't quite cater for any specific needs when the Container component is implemented by the customer themselves.

Ideally, the solution should be to simply export the background properties via the sling model JSON export.

msagolj commented 3 years ago

Hi @znikolovski we would greatly appreciate a contribution in form of a PR. As a starting point there are already 2 private methods in the AbstractContainerImpl: https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/AbstractContainerImpl.java#L156-L178 which could be exposed via the Container model API.

slabelle-gorilla commented 3 years ago

Hi @msagolj I'm using the latest core component version and I still not seeing the backgroundStyle in the json response. AEM Version 6.5.5 Core Component Version: 2.16.0 And I'm using core/wcm/components/container/v1/container in sling:resourceSuperType