Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CQ5: Inheriting/Extended Dialogs

Tags:

aem

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

like image 506
Brodie Avatar asked Jan 22 '14 20:01

Brodie


People also ask

How do you inherit dialog in AEM?

The best you can do is to include the dialog tabs using path property. 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.

How do I hide dialog property in AEM?

I have tried to hide few properties of a node (Link Items) in List component (image below). Have added the property "sling:hideProperties String[] fieldDescription, text" in the linkitems node (image below). The field properties fieldDescription and text has been hidden (image below). Save this answer.

Which Xtype should you use if you want to reuse a part of a dialog in another dialog?

xtype - AEM: Trying to reuse existing image dialog in other dialog.

What is cq design dialog?

The Design dialog is provided when a component has design details that can be edited in Design Mode. The definition is very similar to that of a dialog used for editing content, with the difference that it is defined as a node: Node name: cq:design_dialog.


2 Answers

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.
like image 157
Rajesh Pantula Avatar answered Oct 18 '22 04:10

Rajesh Pantula


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.

like image 33
user1057653 Avatar answered Oct 18 '22 05:10

user1057653