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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Editable Template - Retrieve component dialog value

sathya_prakasha
Level 5
Level 5

Hi All,

I would like to get a component dialog value from editable template ..how to get it?

Component  : /conf/AEMLearning64/settings/wcm/templates/testing-template/structure/jcr:content/root/navigation

Below code :

ContentPolicyManager contentPolicyManager = getResourceResolver().adaptTo(ContentPolicyManager.class);

if(contentPolicyManager !=null) {

ContentPolicy contentPolicy = contentPolicyManager.getPolicy(getCurrentpage().getContentResource());   // or resource

if(contentPolicy != null) {

navigationPath = contentPolicy.getProperties().get("navigationRoot").toString();

}

}

Here , contentpolicy getting value as null.

Regards,

Sathya

4 Replies
ArpitVarshney
Community Advisor
Community Advisor

Hi sathya prakasha14176564

If you have created a design dialog of a navigation component and want to retreive it in component HTL file.The corresponding data is stored inside policies of editable template and can be simply retrieved using ${currentStyle.propertyName}

Regards,

Arpit Varshney

Arun_Patidar
Community Advisor
Community Advisor

Can you check the property name, your code looks ok though

e.g.

ContentPolicyManager policyManager = resourceResolver.adaptTo(ContentPolicyManager.class);

if (policyManager != null) {

     ContentPolicy contentPolicy = policyManager.getPolicy(resource);

     if (contentPolicy != null) {

          title= (String) contentPolicy.getProperties().get("title");

     }

}

sathya_prakasha
Level 5
Level 5

Hi Arun,

Thanks for your reply !

Component values are stored under editable template :/conf/AEMLearning64/settings/wcm/templates/testing-template/structure/jcr:content/root/navigation

I am getting a null value in contentPolicy object if i try to pass resource or currentPage.getContentResource

Regards,

Sathya

Arun_Patidar
Community Advisor
Community Advisor

Can you check if object getCurrentpage() is not null