Working with building blocks - nested container | Community
Skip to main content
Level 2
September 7, 2023
Solved

Working with building blocks - nested container

  • September 7, 2023
  • 1 reply
  • 975 views

Hi

 

Context:

We're recently implemented building blocks functionality in our project. We have a custom layout container component which we use as base to drag/drop components. But this custom component was not supporting the drag/drop of building block in it.

Yes, we've made sure to set policy for the layout container to include building block, but still it didn't work out. So we used WKND package, and created an overlay of 'core/wcm/components/container/v1/container' and create a new XF template around it. And we were able to achieve it.

 

Problem:

We are trying to using this overlayed container component, in a custom wrapper component (using data-sly-resource). This is causing two issues:

  1. We're not able to drag/drop building blocks like we used to (if the container is nested, instead of base for the XF)
  2. We've tried setting policy manually for nested container to include our components, as well as building block component. We're not able to drag/drop any components inside nested container.

Attaching code-snippet of data-sly-resource. 

<div class="<my-class> aem-GridColumn"> <sly data-sly-resource="${'container' @ resourceType='<my-project>/components/content/containers/container'}"> </sly> </div>

Any help is appreciated. Thanks, in advance.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

hello @cmanoha1 

 

I am able to add components to the container.

 

Here are the steps I tried. Please let me know, what am I missing:

1. add container to seperator component

2. I go to the Seperator and click on container to add components

 

Please note that with following all components are added under container node of separator.

<sly data-sly-resource="${'container' @ resourceType='wknd/components/container'}">

 

 

 

And the policy that it is picking is /conf/wknd/settings/wcm/templates/landing-page-template/policies/jcr:content/root/container

So, any components that are allowed via policy on this level, are also available for the component

 

1 reply

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
September 7, 2023

hello @cmanoha1 

 

I am able to add components to the container.

 

Here are the steps I tried. Please let me know, what am I missing:

1. add container to seperator component

2. I go to the Seperator and click on container to add components

 

Please note that with following all components are added under container node of separator.

<sly data-sly-resource="${'container' @ resourceType='wknd/components/container'}">

 

 

 

And the policy that it is picking is /conf/wknd/settings/wcm/templates/landing-page-template/policies/jcr:content/root/container

So, any components that are allowed via policy on this level, are also available for the component

 

Aanchal Sikka
cmanoha1Author
Level 2
September 7, 2023

Hi @aanchal-sikka 

Thanks for the suggestion. It did help me diagnose the issue. In my case it was due to an internal JS script.

 

Thanks!