CQ5: Inheriting/Extended Dialogs

試著忘記壹切 提交于 2019-12-01 17:48:06

问题


For reference, I'm on CQ5.5

I am curious if there is any way to extend upon an inherited dialog, without overwriting it's parent dialog.

For example, have a structure as follows:

base-page-template
   - dialog
      - title
      - description

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

What I'm trying to avoid is for example: I need to add a new property to base-page that should show up on all page templates that extend from base-page. My current solution is to add that property to all dialogs separately. So for example, in the above structure I would have to add the new "default property" to both the base-page and the inherited-from-base-page dialogs.

The only other option I could think of was creating a panel node that represents "base page" and then including that panel w/ an xtype:cqinclude node.

Before going with the latter route I'm curious if anyone has extended their dialogs in the fashion I'm describing above.

Any help is greatly appreciated, Thank you, Brodie


回答1:


No, there is no way to directly inherit dialogs. The best you can do is to include the dialog tabs using path property.

You should create your tab your tabs in a different location and you can include it in your dialog using path property like shown below:

<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>    

Where tab1 and tab2 are tab panels.

So, in your case it will be something like this :

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.



回答2:


The above answer provided by Rajesh is correct w.r.t to dialog.xml written for classic UI interface in AEM.

The touch UI equivalent of cqinclude is sling:resourceType="granite/ui/components/foundation/include". Example:

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

With touch UI in AEM, A different kind of dialog inheritance is possible using the sling:resourceSuperType property, however please note that this does not inherit dialog properties from its live copy parent. The dialog is inherited from its sling resource super-type.

I understand that this feature is not a solution to the problem described above, Just wanted to point out that dialog inheritance is possible with the new TOUCH-UI authoring.

Following is an example.

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

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

In the above example, the page-dialog-tab would have the following four properties in its dialog.

- dialog
- title
- description
- custom field

A few useful config options available like sling:hideProperties, sling:hideResource, sling:hideChildren and sling:orderBefore to hide and order properties in the dialog.



来源:https://stackoverflow.com/questions/21293839/cq5-inheriting-extended-dialogs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!