adding parsys from code in aem 6.5

Avatar

Avatar
Boost 3
Level 3
kiranc13433869
Level 3

Likes

3 likes

Total Posts

58 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Boost 3
Level 3
kiranc13433869
Level 3

Likes

3 likes

Total Posts

58 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
kiranc13433869
Level 3

22-09-2020

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

23-09-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.

Answers (4)

Answers (4)

Avatar

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

148 likes

Total Posts

162 posts

Correct reply

42 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

148 likes

Total Posts

162 posts

Correct reply

42 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile
Suraj_Kamdi
MVP

23-09-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>

Avatar

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
Singaiah_Chintalapudi
MVP

22-09-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

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

22-09-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.

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

22-09-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.