Editable Template - Retrieve component dialog value | Community
Skip to main content
AEMLearner-1989
Level 4
November 1, 2019

Editable Template - Retrieve component dialog value

  • November 1, 2019
  • 4 replies
  • 4683 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

ArpitVarshney
Community Advisor
Community Advisor
November 1, 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

arunpatidar
Community Advisor
Community Advisor
November 2, 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");

     }

}

Arun Patidar
AEMLearner-1989
Level 4
November 4, 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

arunpatidar
Community Advisor
Community Advisor
November 4, 2019

Can you check if object getCurrentpage() is not null

Arun Patidar