Expand my Community achievements bar.

SOLVED

adding parsys from code in aem 6.5

Avatar

Level 4

hi,

 

I am working on aem 6.5

So far adding parsys was done by editable templates and not for code.

My requirement is to create component which just has one parsys in it and i can drag drop components in it.

is it possible to add it from code?

can you please help me with such component.

 

here i am able to add parsys but problem with 6.5 is i can not add components in it as we specify required component list in template level.

1 Accepted Solution

Avatar

Correct answer by
Level 8

@kiranc13433869 

If you are drag & dropping a component(which has child/nested parsys in it) into layout container responsive grid of editable templates then all the components which are allowed in that particular layout container policies at editable template level are by default allowed to add in that child/nested parsys inside that particular component.

 

/content/page/jcr:content/root/          -       layout container root (say you have allowed 'x' component group or 'y' components by editing template or through code by defining policies under /conf/project/settings/wcm/policies/wcm/foundation/components/responsivegrid/policy_34324324 & map this to policy as value to cq:policy property under /conf/project/settings/wcm/templates/content-page/policies/jcr:content/root)

 

Drag & drop component A

 

/content/page/jcr:content/root/componentA/       -       component A

 

Component A has parsys in it say 'new_par'

 

/content/page/jcr:content/root/componentA/new_par     -     this parsys new_par by default inherited/enabled with 'x' component group or 'y' components which allowed in parent layout container responsive grid.

 

to answer your query we can set this allowed component policies through code or by editing templates as well.

View solution in original post

6 Replies

Avatar

Level 9

Yeah, you should be able to add the parsys and this is very commons requirement. The new parsys is located at: wcm/foundation/components/parsys/newpar

 

Yes, you should manage this in the code and here is the sample snippet how you can include parsys in the component: 

<sly data-sly-resource="${'myComponent' @ resourceType='wcm/foundation/components/parsys/newpar'></sly>

 

You can look at the tabs and carousel core components for more info.

 

Thanks,

Singaiah

Avatar

Level 8

@kiranc13433869 

 

If you are drag & dropping a component(which has child/nested parsys in it) into layout container responsive grid of editable templates then all the components which are allowed in that particular layout container policies at editable template level are by default allowed to add in that child/nested parsys inside that particular component.

 

/content/page/jcr:content/root/          -       layout container root (say you have allowed 'x' component group or 'y' components by editing template or through code by defining policies under /conf/project/settings/wcm/policies/wcm/foundation/components/responsivegrid/policy_34324324 & map this to policy as value to cq:policy property under /conf/project/settings/wcm/templates/content-page/policies/jcr:content/root)

 

Drag & drop component A

 

/content/page/jcr:content/root/componentA/       -       component A

 

Component A has parsys in it say 'new_par'

 

/content/page/jcr:content/root/componentA/new_par     -     this parsys new_par by default inherited/enabled with 'x' component group or 'y' components which allowed in parent layout container responsive grid.

 

to answer your query we can set this allowed component policies through code or by editing templates as well.

Avatar

Level 8

@kiranc13433869 

 

If you are drag & dropping a component(which has child/nested parsys in it) into layout container responsive grid of editable templates then all the components which are allowed in that particular layout container policies at editable template level are by default allowed to add in that child/nested parsys inside that particular component.

 

/content/page/jcr:content/root/          -       layout container root (say you have allowed 'x' component group or 'y' components by editing template or through code by defining policies under /conf/project/settings/wcm/policies/wcm/foundation/components/responsivegrid/policy_34324324 & map this to policy as value to cq:policy property under /conf/project/settings/wcm/templates/content-page/policies/jcr:content/root)

 

Drag & drop component A

 

/content/page/jcr:content/root/componentA/       -       component A

 

Component A has parsys in it say 'new_par'

 

/content/page/jcr:content/root/componentA/new_par     -     this parsys new_par by default inherited/enabled with 'x' component group or 'y' components which allowed in parent layout container responsive grid.

 

to answer your query we can set this allowed component policies through code or by editing templates as well.

Avatar

Community Advisor

Just add the following line of code inside wrapping HTML div

 

<sly data-sly-resource="${'par' @resourceType = 'wcm/foundation/components/parsys'}"></sly>

 

or else you can also use a responsive grid where we can set policies to allow list of component.

<sly data-sly-resource="${'responsive-grid' @resourceType = 'wcm/foundation/components/responsivegrid'}"></sly>

Avatar

Correct answer by
Level 8

@kiranc13433869 

If you are drag & dropping a component(which has child/nested parsys in it) into layout container responsive grid of editable templates then all the components which are allowed in that particular layout container policies at editable template level are by default allowed to add in that child/nested parsys inside that particular component.

 

/content/page/jcr:content/root/          -       layout container root (say you have allowed 'x' component group or 'y' components by editing template or through code by defining policies under /conf/project/settings/wcm/policies/wcm/foundation/components/responsivegrid/policy_34324324 & map this to policy as value to cq:policy property under /conf/project/settings/wcm/templates/content-page/policies/jcr:content/root)

 

Drag & drop component A

 

/content/page/jcr:content/root/componentA/       -       component A

 

Component A has parsys in it say 'new_par'

 

/content/page/jcr:content/root/componentA/new_par     -     this parsys new_par by default inherited/enabled with 'x' component group or 'y' components which allowed in parent layout container responsive grid.

 

to answer your query we can set this allowed component policies through code or by editing templates as well.