Highlighted

Read page design(policy) of editable template in a component

Shallu_Rohilla

02-05-2018

Hi,

I have added a new design property of a template i.e. added a new property in the cq:designDialog of the template base component.

I am trying to retrieve value of this page design property in a specific component using currentStyle but it is returning blank.

I can see the property saved under the policy node. E.g path:

/conf/core/settings/wcm/policies/core/components/structure/basepage/policy_2073067013511.

How can I retrieve this. I tried this code as well but it doesn't work. "contentPolicy " is returned null. I guess it works for component design policy only.

ResourceResolver resourceResolver = getRequest().getResourceResolver();

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

        if (policyManager != null)

        {

        ContentPolicy contentPolicy = policyManager.getPolicy(this.getResource());

          if (contentPolicy != null) {

            this.faviconPath = contentPolicy.getProperties().get("faviconpath", "test").toString();

            LOGGER.info("faviconPath: " + faviconPath);

          }

        }

Any help would be appreciated.

Regards,

Shallu Rohilla