'Difference between currentstyle and currentdesign in AEM

In AEM speak - what is the exact conceptual difference between between currentstyle and currentdesign objects available after including the tag in template / component?

aem


Solution 1:[1]

Just to add some clarify to what's already here:

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
  • currentDesign is /etc/designs/default

Solution 2:[2]

currentStyle is of type com.day.cq.wcm.api.designer.Style(1) whereas currentDesign is an instance of com.day.cq.wcm.api.designer.Design (2).

The Design object contains information about the design that is used with the current object, it is most of the time set in the cq:designPath property of the page's template.

If you have the Design object, you can get Style objects for each included Cell(3) from it. On the other hand you can get the surrounding Design, if you have the Style.

So the Design is something like a container object for the Styles used in the included Cells.

In this path

/etc/designs/geometrixx/jcr:content/page/image

image is a Cell, the design path is /etc/designs/geometrixx and the Style object attached to the Cell object has two properties: maxHeight and maxWidth.

see screenshot

(1): https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/index.html?com/day/cq/wcm/api/designer/Design.html

(2): https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/index.html?com/day/cq/wcm/api/designer/Style.html

(3): https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/index.html?com/day/cq/wcm/api/designer/Cell.html

Solution 3:[3]

I would say it is more like: /etc/designs/<design>/jcr:content/<resource-type-of-page>/<component> so that different templates having the same page resource type will share the same style

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Richard Szalay
Solution 2 Oliver Gebert
Solution 3 Nono Junang