2014-01-22 88 views
4

仅供参考,我在CQ5.5CQ5:继承/扩展对话框

我很好奇,如果有办法在继承的对话延长,而不会覆盖它的父对话框。

例如,有一种结构如下:

base-page-template 
    - dialog 
     - title 
     - description 

inerited-from-base-page 
    - dialog 
     - custom field 
     --------------- [inherited from parent] 
     - title 
     - description 

我试图避免的,例如:我需要添加一个新的属性,以立足页面应该出现在所有的页面模板从基本页面扩展。我目前的解决方案是将该属性分别添加到所有对话框中。因此,例如,在上述结构中,我必须将新的“默认属性”添加到基本页面和从基本页面继承的对话框。

我能想到的唯一的其他选择是创建一个代表“基本页面”的面板节点,然后将该面板包含在w/xtype:cqinclude节点中。

在开始使用后一种路线之前,我很好奇是否有人以我上面描述的方式扩展对话框。

任何帮助是极大的赞赏,谢谢, 布罗迪

回答

9

没有,有没有办法直接继承对话框。您可以做的最好的做法是使用路径属性包含对话框选项卡。

您应该创建标签在不同的位置你的标签,你可以使用path属性包括它在对话框中如下所示:

<items jcr:primaryType="cq:WidgetCollection"> 
     <tabs jcr:primaryType="cq:TabPanel"> 
      <items jcr:primaryType="cq:WidgetCollection"> 
       <tab1 
         jcr:primaryType="cq:Widget" 
         path="/apps/myproject/tab1.infinity.json" 
         xtype="cqinclude"/> 
       <tab2 
         jcr:primaryType="cq:Widget" 
         path="/apps/myproject/tab2.infinity.json" 
         xtype="cqinclude"/> 

      </items> 
     </tabs> 
</items>  

凡TAB1和TAB2是标签面板。

所以,你的情况会是这样的:

base_page_dialog_tab 
     - dialog 
     - title 
     - description 

inherited page-dialog-tab 
     - custom field 


base-page-template 
    - include base page dialog tab here. 

inerited-from-base-page 
    - include Tab 1 - inherited page-dialog tab using path property 
    - include Tab 2 - base page dialog tab using path property. 
+0

我想这将是唯一的选择,谢谢你经历包括一个例子的麻烦。现在,我没有理由认为它不值得一个绿色的复选标记:D – Brodie

1

由拉杰什提供上述答案是dialog.xml在AEM经典UI界面编写正确w.r.t。

cqinclude的touch UI相当于sling:resourceType =“granite/ui/components/foundation/include”。 例子:

<basic 
    jcr:primaryType="nt:unstructured" 
    sling:resourceType="granite/ui/components/foundation/include" 
    path="foundation/components/page/cq:dialog/content/items/tabs/items/basic"/> 

随着AEM触摸UI,别样对话框继承的是可能使用吊索:resourceSuperType财产,但是请注意,这不继承从现场拷贝父对话框属性。该对话框是从其吊索资源超级类型继承的。

我知道这个功能并不是解决上述问题的方法,只是想指出,新的TOUCH-UI创作可以实现对话框继承。

以下是一个例子。

base_page_dialog_tab (sling:resourceType='A') 
     - dialog 
     - title 
     - description 

page-dialog-tab (sling:resourceSuperType=sling:resourceSuperType='A') 
     - custom field 

在上例中,页面对话框选项卡的对话框中将包含以下四个属性。

- dialog 
- title 
- description 
- custom field 

一些有用的配置可以像吊带选项:hideProperties,吊带:hideResource,吊带:hideChildren和吊带:orderBefore隐藏并在对话框中顺序的属性。