Expand my Community achievements bar.

SOLVED

AEM | How to restrict components on responsive grid added inside another component ?

Avatar

Community Advisor

Hi Team

 

    We are currently working on developing a column control component with two columns and two containers. We need to restrict certain components to the first column cotainer and a different set of components to the second container. However, We can set policies only on container component and it gets applied to every container. Is there a way we can achieve this?

 

Thanks

Veena

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @VeenaVikraman 

You can assign different policies to the column components only if each column is a separate component. You could create proxy components for each column to apply different policies.

Then, you can directly set the desired policies to those individual column components.

 

If you need to set different policy for a component differently if used another component then you can use something like below.

For example, if I want different policy for a parsys within tabs component then I can use something like below:

 

<tabs 
	cq:policy="myproj/components/content/tabs/policy_tabs_1" 
	jcr:primaryType="nt:unstructured" 
	sling:resourceType="wcm/core/components/policies/mapping">
    <wcm jcr:primaryType="nt:unstructured">
        <foundation jcr:primaryType="nt:unstructured">
            <components jcr:primaryType="nt:unstructured">
                <parsys 
                	cq:policy="myproj/components/content/tabs/policy_tabs-parsys" 
                	jcr:primaryType="nt:unstructured" 
                	sling:resourceType="wcm/core/components/policies/mapping" />
            </components>
        </foundation>
    </wcm>
</tabs>



Arun Patidar

View solution in original post

2 Replies

Avatar

Level 6

Can you try creating a new container proxy component and setting policies for it? I think it is worth trying this workaround if we don't find any viable solution.

Avatar

Correct answer by
Community Advisor

Hi @VeenaVikraman 

You can assign different policies to the column components only if each column is a separate component. You could create proxy components for each column to apply different policies.

Then, you can directly set the desired policies to those individual column components.

 

If you need to set different policy for a component differently if used another component then you can use something like below.

For example, if I want different policy for a parsys within tabs component then I can use something like below:

 

<tabs 
	cq:policy="myproj/components/content/tabs/policy_tabs_1" 
	jcr:primaryType="nt:unstructured" 
	sling:resourceType="wcm/core/components/policies/mapping">
    <wcm jcr:primaryType="nt:unstructured">
        <foundation jcr:primaryType="nt:unstructured">
            <components jcr:primaryType="nt:unstructured">
                <parsys 
                	cq:policy="myproj/components/content/tabs/policy_tabs-parsys" 
                	jcr:primaryType="nt:unstructured" 
                	sling:resourceType="wcm/core/components/policies/mapping" />
            </components>
        </foundation>
    </wcm>
</tabs>



Arun Patidar