adding parsys from code in aem 6.5 | Community
Skip to main content
Level 4
September 22, 2020
Solved

adding parsys from code in aem 6.5

  • September 22, 2020
  • 5 replies
  • 16466 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manjunath_K

@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.

5 replies

Singaiah_Chintalapudi
Level 7
September 22, 2020

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

Manjunath_K
Level 7
September 22, 2020

@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.

Manjunath_K
Level 7
September 22, 2020

@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.

Suraj_Kamdi
Community Advisor
Community Advisor
September 23, 2020

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>

Manjunath_K
Manjunath_KAccepted solution
Level 7
September 23, 2020

@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.

Level 2
February 13, 2023