CQ5: Inheriting/Extended Dialogs
Asked Answered
G

2

5

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

Gutbucket answered 22/1, 2014 at 20:57 Comment(0)
D
11

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.
Doi answered 23/1, 2014 at 5:29 Comment(1)
I figured this would be the only option left, thank you for going through the trouble of including an example. For now, I see no reason it doesn't deserve a green checkmark :DGutbucket
R
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.

Roa answered 1/2, 2017 at 10:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.