Highlighted

allowedchildren and allowedparent at cq:component level

Rajashankar

25-06-2018

Hi All,

I know at template level we have allowedpath,allowedchildren and allowedparent. But i am trying to use allowedparent and allowedchildren at cq:component level.

In detail:

As per the below documentation link from Adobe it seems like CQ:component has property allowedchildren and allowedparent

Custom Node Types

I created a custom page component and baked in two Parsys as shown below

mycomp.jsp

<cq:include path="dumppar" resourceType="foundation/components/iparsys" />

<cq:include path="altpar" resourceType="foundation/components/iparsys" />

and i extended and create a structure component title component and to this component i added property allowedparents as shown below. Meaning this title component should be allowed to drag and drop to "dumppar" parsys. But its is getting dragged and drop allowed in "altpar" parsys comp also,

dragcomp":{"jcr:primaryType":"cq:Component","jcr:createdBy":"admin","jcr:title":"drcmp","allowedParents":["*/dumppar"],"jcr:created":"Mon Jun 25 2018 16:58:46 GMT-0500","sling:resourceSuperType":"/libs/foundation/components/title","componentGroup":"drgcmp"}

Similarly i set the below to mycomp "allowedchildren" as shown below. But my other structure component called "altcomp" is also getting allowed to dropped in mycomp parsys.

{"jcr:primaryType":"nt:folder","jcr:createdBy":"admin","jcr:created":"Mon Jun 25 2018 16:34:23 GMT-0500","dumpcomp":{"jcr:primaryType":"cq:Component","jcr:createdBy":"admin","jcr:title":"dmcp","jcr:created":"Mon Jun 25 2018 16:34:23 GMT-0500","sling:resourceSuperType":"/libs/foundation/components/page","allowedChildren":["*/*dragcomp"],"componentGroup":".hidden","dumpcomp.jsp":{"jcr:primaryType":"nt:file","jcr:createdBy":"admin","jcr:created":"Mon Jun 25 2018 16:34:23 GMT-0500","jcr:content":{"jcr:primaryType":"nt:resource","jcr:lastModifiedBy":"Administrator","jcr:mimeType":"text/plain","jcr:lastModified":"Mon Jun 25 2018 17:04:09 GMT-0500",":jcr:data":285,"jcr:uuid":"c08ef0d3-bde1-4ae9-ba1f-0dfe6447ef74"}}},"dragcomp":{"jcr:primaryType":"cq:Component","jcr:createdBy":"admin","jcr:title":"drcmp","allowedParents":["*/dumppar"],"jcr:created":"Mon Jun 25 2018 16:58:46 GMT-0500","sling:resourceSuperType":"/libs/foundation/components/title","componentGroup":"drgcmp"},"altcomp":{"jcr:primaryType":"cq:Component","jcr:createdBy":"admin","jcr:title":"ac1","jcr:created":"Mon Jun 25 2018 22:53:10 GMT-0500","sling:resourceSuperType":"/libs/foundation/components/logo","componentGroup":"drgcmp"}}

My requirement is I need to set allowedchildren for parsys backed in my component so that only allowed children can be dragged and dropped to parsys or iparsys.Similarly i want to limit at structure components like title or breadcrumb by adding allowedparent allowing it to get added only to mentioned parsys parent.

Please suggest how to use allowedchildren and allowedparent at component level.

Replies

Highlighted

Rajashankar

26-06-2018

Hi Visser,

I tried seperately as well as together.Could you please help me with some documentation or reference on this property usage.I am not able to find any in Adobe forum or reference materials on their usage.

Highlighted

smacdonald2008

26-06-2018

You should be using editable templates and policies to address this requirement  if you are using AEM 6.3/6.4. Editable templates and using  polices are best practice.

As well you should be using an AEM Core Page component.