I have created a custom container component which extends the core container component with following code in its overlayed HTL(this component is exactly the same as the one we get in AEM project archetype except this modified HTL):
<sly data-sly-use.customContainer="com.trainingProject.core.models.CustomContainer">
<sly data-sly-test.hasFragment="${customContainer.fragmentPresent}">${customContainer.htmlSrc @CONTEXT='html'}</sly>
</sly>
<sly data-sly-test=${!hasFragment} data-sly-use.container="com.adobe.cq.wcm.core.components.models.LayoutContainer">
<sly data-sly-test.responsive="${container.layout == 'RESPONSIVE_GRID'}"
data-sly-use.responsiveGridTemplate="responsiveGrid.html"
data-sly-call="${responsiveGridTemplate.responsiveGrid @ container=container}"></sly>
<sly data-sly-test.simple="${!responsive}"
data-sly-use.simpleTemplate="simple.html"
data-sly-call="${simpleTemplate.simple @ container=container}"></sly>
</sly>
This Custom container component is authored on template structure of an editable template.
Whenever a component (say component X) is dragged-dropped inside this custom container, and we open the page created using this template on browser, the sling model of Component X gets currentPage (injected using @ScriptVariable private Page currentPage
However, the same component X authored on the same template but outside of the custom container component gives the correct currentPage(the one we are browsing). It render all other components(eg text, accordion etc) fine which do not have a dependency on currentPage to render the data.
There seems to be something wrong with the custom container as the same component X works fine with the OOTB core container component.
I am not sure why are we not able to get the correct currentPage(the one we are browsing) using custom container.
Any help is appreciated
I am using AEM could service sdk and java 11
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
@robinbhatmerkle I tried to reproduce the case you mentioned by duplicating the container and having a sample component dragged in it. The component I created uses the same annotation as described by you and I get the page path only!!
May be you can share you custom container code to get more details about it.
Best regards,
Himanshu Singhal
@robinbhatmerkle I tried to reproduce the case you mentioned by duplicating the container and having a sample component dragged in it. The component I created uses the same annotation as described by you and I get the page path only!!
May be you can share you custom container code to get more details about it.
Best regards,
Himanshu Singhal
hi @robinbhatmerkle ,
Even I tried as @Himanshu_Singhal and I am also getting page path, can you share your code so that we can dig better to help you with resolving the issue.
Thanks.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies