Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.3 - How to read design properties within component helper for a dynamic editable template

Avatar

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
mail2saravana_p
Level 2

04-04-2018

I have a dynamic editable template with design dialog at page component. The design properties are persisted under /conf/myapp/settings/wcm/policies/myapp like this:

jWwwf.png

My requirement is to read these page level design properties and use them inside an Image component. I have design dialog at component level as well. So when I do ${currentStyle.property}, it renders the component level design property.

Next I wrote a helper class like this:

Designer designer = currentPage.getContentResource().getResourceResolver().adaptTo(Designer.class);
  Design pageDesign = designer.getDesign(currentPage);
  Style pageStyle = pageDesign.getStyle(pageDesign.getPath());
  return pageStyle.get(PROPERTY_ANALYTICSPAGETYPE, String.class);

This code is trying to read page level design properties under /etc/designs/myapp authored under cq:designPath and NOT reading under /conf policies. Now how I read the /conf policy nodes and access those properties?

How to access page level design properties within a component?

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

04-04-2018

When Sling APIs do not work - you can always try reading the node props using the JCR API.

I am not aware of any examples that show how to read editable template node props using the Designer API.

Avatar

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
mail2saravana_p
Level 2

06-04-2018

Hi Sam,

I didnt want to access at JCR level. When policy changes, or new policies are added, I ll end up writing logic to search for right node. Was wondering if there is an API way of accessing these policies.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

06-04-2018

There is not an API that lets you specifically read editable template policies.

Avatar

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
mail2saravana_p
Level 2

Likes

6 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
mail2saravana_p
Level 2

11-06-2018

This question is closed. I got the answer from sof