Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Reusing Component policy in another component

Avatar

Level 1

I have defined the component policy for COMPONENT A. Is it possible to reuse the Component policy of COMPONENT A in COMPONENT B?

@smacdonald2008 

3 Replies

Avatar

Community Advisor

Try with

 <componentB
cq:policy="aemlab/oneweb/components/image/policy_componentA"
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/core/components/policies/mapping"/>


Arun Patidar

Avatar

Level 1

Thanks for the reply @arunpatidar 

Let me reframe my requirement here. I have defined Styles on Component A Policy and I want to reuse this Component A Styles on Component B in addition to the Component B Specific Styles.

Requirement here is to reuse already defined styles of Component A on Component B and Components B should also have its own policy. 

 

The above solution which you provided will only inherit component A policy on component B.

Avatar

Community Advisor

The policy combination is not supported. you can't refer two policies at the same time.



Arun Patidar