Skip to main content
Level 6
May 16, 2022

Policies in AEM6.5

<image_policy
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/core/components/policy/policy"
jcr:title="Image"
allowUpload="false"
allowedRenditionWidths="[960,720,590]"
small="300x200"
cq:styleDefaultClasses="l-content-width">
<jcr:content jcr:primaryType="nt:unstructured"/>
<cq:styleGroups jcr:primaryType="nt:unstructured">
<item0 jcr:primaryType="nt:unstructured">
<cq:styles jcr:primaryType="nt:unstructured">
<item0
cq:styleClasses="l-content-width l-content-width--narrow"
cq:styleId="1603361754179"
cq:styleLabel="Small"
jcr:primaryType="nt:unstructured"/>
</cq:styles>
</item0>
</cq:styleGroups>
</image_policy>

Hi

I am trying to understand how will this policy apply the classes. This policy is used for the image component in an area. What are the different cq: styles refering to?

Also what is the variable currentStyle.offCanvasDivCss refering to in the template?

<div class="${currentStyle.offCanvasDivCss}" data-sly-unwrap="${!currentStyle.offCanvasDivCss}">

 

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

4 replies

SantoshSai
Community Advisor
Community Advisor
May 16, 2022

Hi @anasustic 

Here are the detailed documentation about policies  -

1. https://experienceleague.adobe.com/docs/experience-manager-64/forms/administrator-help/work-with-document-security/creating-policies.html?lang=en
2. https://medium.com/adobetech/fantastic-aem-configurations-and-how-to-code-them-edb5663e983f

cq:style - https://experienceleague.adobe.com/docs/experience-manager-learn/sites/developing/style-system-technical-video-understand.html?lang=en

currentStyle - Access design_dialog(currentStyle) properties.

Global content (that is, component values that are common across multiple instances of the same template) are stored as "styles" and edited via a "design dialog".

They are stored as follows:

/etc/designs/<design>/jcr:content/<template>/<component>

So, for the component logo in the template homepage, using the default design:

  • currentStyle is /etc/designs/default/jcr:content/homepage/logo


Hope this helps you!

Regards,
Santosh

Translate
Santosh Sai
anasusticAuthor
Level 6
May 17, 2022

Hi

Will the class

cq:styleDefaultClasses

be applied to any component of type Image in my case?

If I understand correctly the documentation is the 

cq:styleGroups

available for Editors when they want to style the image component themselves. Is that correct?  

Translate
arunpatidar
Community Advisor
Community Advisor
May 17, 2022

Hi, Yes this is the additional class applied to your component 

https://medium.com/adobetech/using-aem-style-system-to-increase-reusability-of-components-8177c5b65c9e

Translate
Arun Patidar