How can I inherit more than one component ?
I have a custom component and I want to inherit OOTB image component and text component in my newly created component.
I have a custom component and I want to inherit OOTB image component and text component in my newly created component.
You can do for the OOTB inherit
<div data-sly-resource="${'par1' @ resourceType='core/wcm/components/image/v2/image'}"></div>
and for your custom component you can simply apply the above code with your component path,
for eg, I am taking wknd project then your path will be:
<div data-sly-resource="${'par2' @ resourceType='wknd/components/yourcomponent'}"></div>
Now if you want to include only one field from a component then you can use below code and use it in HTL,
for eg. a component name nearbycomponent have 4 field and you want only one field then you can use the below code:
<firstName
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/include"
path="/apps/wknd/components/nearbycomponent/cq:dialog/content/items/column/items/firstName"/>Here, I have take firstName field from nearbycomponent. you can just paste this code in your newly created component cq dialog. and use in your HTL by properties object or by calling model.
Thanks,
let me know for any other help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.