AEM 中 currentstyle 和 currentdesign 的区别

Difference between currentstyle and currentdesign in AEM

在 AEM 中 - 在模板/组件中包含标签后可用的 currentstyle 和 currentdesign 对象之间在概念上的确切区别是什么?

currentStylecom.day.cq.wcm.api.designer.Style(1) 类型,而 currentDesigncom.day.cq.wcm.api.designer.Design (2).

的实例

Design 对象包含有关与当前对象一起使用的设计的信息,大部分时间设置在页面模板的 cq:designPath 属性 中。

如果您有 Design 对象,您可以从中为每个包含的 Cell(3) 获得 Style 个对象。另一方面,如果你有 Style.

,你可以获得周围的 Design

因此 Design 类似于包含的 Cell 中使用的 Style 的容器对象。

在此路径中

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

image是一个Cell,设计路径是/etc/designs/geometrixx并且附加到Cell对象的Style对象有两个属性:maxHeightmaxWidth.

(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

只是为了澄清一下这里已有的内容:

全局内容(即同一模板的多个实例中通用的组件值)存储为 "styles" 并通过 "design dialog".

进行编辑

它们的存储方式如下:

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

因此,对于模板 homepage 中的组件 logo,使用 default 设计:

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

我会说它更像是: /etc/designs/<design>/jcr:content/<resource-type-of-page>/<component> 这样具有相同页面资源类型的不同模板将共享相同的样式