Highlighted

Editable Template - Retrieve component dialog value

sathya_prakasha

01-11-2019

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

Replies

Highlighted

ArpitVarshney

MVP

01-11-2019

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

Highlighted

Arun_Patidar

MVP

01-11-2019

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

     }

}

Highlighted

sathya_prakasha

03-11-2019

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