Expand my Community achievements bar.

Editable Template - Retrieve component dialog value

Avatar

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

Avatar

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

Avatar

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");

     }

}



Arun Patidar

Avatar

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

Avatar

Community Advisor

Can you check if object getCurrentpage() is not null



Arun Patidar