Skip to content

Instantly share code, notes, and snippets.

@Surajkamdi
Forked from kevinweber/_cq_dialog.xml
Created September 19, 2018 09:49
Show Gist options
  • Save Surajkamdi/75131b9b90f069da43ca55c1fd5a9a3a to your computer and use it in GitHub Desktop.
Save Surajkamdi/75131b9b90f069da43ca55c1fd5a9a3a to your computer and use it in GitHub Desktop.
AEM: Sling Resource Merging & Includes (dialog, inheriting properties)
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<content jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<basic jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<column jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<toggable
jcr:primaryType="nt:unstructured"
sling:hideResource="true"/>
</items>
</column>
</items>
</basic>
</items>
</content>
</jcr:root>

Official documentation: https://docs.adobe.com/docs/en/aem/6-1/develop/platform/sling-resource-merger.html#Properties

Sling Resource Merging with AEM docs can be found here. Specifically look through the docs for the resource merger properties and how you can manipulate different properties.

The resource merger provides the following properties:

sling:hideProperties (String or String[]) Specifies the property, or list of properties, to hide. The wildcard * hides all.

sling:hideResource (Boolean) Indicates whether the resources should be completely hidden, including its children.

sling:hideChildren (String or String[]) Contains the child node, or list of child nodes, to hide. The properties of the node will be maintained. The wildcard * hides all.

sling:orderBefore (String) Contains the name of the sibling node that the current node should be positioned in front of.

These properties affect how the corresponding/original resources/properties (from /libs) are used by the overlay/override (often in /apps).

How to reuse existing dialog elements in other dialogs?

https://helpx.adobe.com/experience-manager/kb/XtypeCqInclude.html

The xtype "cqinclude" can be used to include nodes from a different dialog or JSON file: https://docs.adobe.com/docs/en/aem/6-2/develop/components/xtypes.html

How to get the JSON representation of an element?

Everything in AEM can be accessed in JSON format. For example: /apps/core-project/components/content/bl16-quote/_cq_dialog.json

If you want to access/include something more specific: /apps/core-project/components/content/bl16-quote/_cq_dialog/content/items.json

If you add .infinity, you get the selected node plus all children: /apps/core-project/components/content/bl16-quote/_cq_dialog.infinity.json

A number gives you a certain depth of children: /apps/core-project/components/content/bl16-quote/_cq_dialog.2.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment