Skip to content

How to Merge 2 Dialogs

Use the include component or sling:resourceSuperType to merge dialogs.

Dialogs are one of the most basic and widely used elements to edit content and display information in AEM. A typical use case of AEM dialogs is to reuse one dialog configuration as often as possible to cut down on extra, unnecessary updates. We have two options for doing this: 

  1. The include component - a way to include other resources. It’s an older method of building out components that requires manual input and can be labour-intensive and time-consuming.

  2. Using sling:resourceSuperType - a way to include other resources by maintaining a virtual tree of resources. This method is more dynamic and it makes data organization and manipulation easier because updates are automatic, with less maintenance required.

We see a lot of our users rely upon the include component, and it often works well, but there are several instances where this component doesn’t work:

  1. When there is a text editor (cq/gui/components/authoring/dialog/richtext)

  2. When the text property is “text”, so the data will save in the text variable within AEM

  3. When we want to have a different value that stores the data (jcr:description)

With the include component, we are unable to specify or override the name variable. But with sling:resourceSuperType, we can! 

Here’s how it works:

This configuration prevents us from having to define all the variables and attributes throughout our configurations. We can define them once. In this case, on this node: /apps/dos/components/components/text/cq:dialog/content/items/tabs/items/style/items/text

and reuse them throughout our code. That means if we update our configuration in one spot, it updates everywhere automatically. Everyone loves a time saver!

Subscribe to our newsletter!

Get notified anytime we publish something interesting!

Loading...