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
744 stars 750 forks source link

[Data Layer] Extension point for data layer properties #1830

Open avitripathy01 opened 3 years ago

avitripathy01 commented 3 years ago

Discussed in https://github.com/adobe/aem-core-wcm-components/discussions/1829

Originally posted by **avitripathy01** September 15, 2021 Hi, Is there a way to extend the core components data layer attributes ? For e.g. currently the Page component has default attributes below. - @type, - dc:title - xdm:language etc. How could I extend to add more attributes to the page object in the data layer ? My initial thought was to override the getComponentData() in the sling model using a custom PageDataBuilder wrapping the core component PageDataBuilder but the parent class GenericDataBuilder is not public either. Any guidance on how to achieve the above requirement?
Thepriestdude commented 2 years ago

Any updates on this?

gabrielwalt commented 2 years ago

Currently, the only way to extend the properties that the core components store in the data layer is to treat the proxy component as a custom component and to follow the guidance provided here: https://github.com/adobe/aem-core-wcm-components/blob/master/DATA_LAYER_INTEGRATION.md#enabling-the-data-layer-for-custom-components

As this is not ideal nor developer friendly, we agree that we should provide a better extension point for the properties that the core components store in the data layer. Therefore, adding this to the "major" milestone.