Skip to content

Instantly share code, notes, and snippets.

@cscuderi
Last active August 19, 2020 16:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cscuderi/0789045bb173c403a711dac81e6fb1b7 to your computer and use it in GitHub Desktop.
Save cscuderi/0789045bb173c403a711dac81e6fb1b7 to your computer and use it in GitHub Desktop.
AEM dialog XML attributes and elements
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/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"
sling:resourceType="cq/gui/components/authoring/dialog"
// Title of the dialog
jcr:title="My component"
// Change the link for the (?) icon in the dialog
helpPath="https://google.com"
>
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<!-- Use tabs in the dialog to separate sections -->
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"
/>
<items jcr:primaryType="nt:unstructured">
<!--
NEW TAB
=======
-->
<iframe
jcr:primaryType="nt:unstructured"
// Title of the tab
jcr:title="Configuration"
// Set tab to active when the dialog is opened
active="{Boolean}true"
sling:resourceType="granite/ui/components/foundation/section"
>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<!--
INPUT: GENERIC ATTRIBUTES
=========================
These should apply to most or all other inputs.
-->
<mygeneric
jcr:primaryType="nt:unstructured"
cq-msm-lockable="src"
// Label shown to authors in the dialog
fieldLabel="This is the label"
// Description shown to authors when they hover the (?)
fieldDescription="Enter something good here."
// Key used to get the value in the model
name="./mygeneric"
// Show or hide the field?
renderHidden="{Boolean}false"
// Make field required
required="{Boolean}true"
// ??? Doesn't do the same as above
allowBlank="{Boolean}false"
// ???
class="calculate-audio-duration"
/>
<!--
INPUT: TEXTFIELD
================
-->
<mytext
sling:resourceType="granite/ui/components/foundation/form/textfield"
jcr:primaryType="nt:unstructured"
cq-msm-lockable="mytext"
fieldLabel="Text"
fieldDescription="Enter something good here."
name="./mytext"
/>
<!--
INPUT: PATHBROWSER
==================
Good for DAM assets.
-->
<source
sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
// Root for path browser
rootPath="/content/dam/glc/audio"
jcr:primaryType="nt:unstructured"
fileNameParameter="./source"
/>
<!--
INPUT: CHECKBOX
===============
-->
<checkme
sling:resourceType="granite/ui/components/foundation/form/checkbox"
jcr:primaryType="nt:unstructured"
fieldText="Check this box"
fieldDescription="You should check this maybe."
name="./checkme"
// Value when the input is checked or selected
value="{Boolean}true"
// Also works for other inputs like selects
// Can also be a string: `value="none"` `value="metadata"`
// Default value of the input
defaultValue="{Boolean}false"
/>
<!--
INPUT: RADIO BUTTONS
====================
-->
<iconPosition
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radiogroup"
text="Icon position">
<items jcr:primaryType="nt:unstructured">
<before
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radio"
name="./iconPosition"
text="Before text"
value="Before"
/>
<after
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/radio"
name="./iconPosition"
text="After text"
value="After"
/>
</items>
</iconPosition>
<!--
INPUT: MULTI-FIELD DIALOG
=========================
(authors can add numerous items with the template below)
-->
<params
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
cq-msm-lockable="qsParams"
fieldDescription="List the parameters that should be included from the querystring store"
fieldLabel="Append the following parameters">
<!-- Template used when adding a new item to the multi-field -->
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
name="./qsParams"
/>
</params>
<!--
NEW CONTAINER
=============
-->
<mycontainer
sling:resourceType="granite/ui/components/foundation/container"
// Title of the container
jcr:title="My container"
jcr:primaryType="nt:unstructured"
>
<!-- Creates a collapsible accordion in the dialog, with the container title -->
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/collapsible"
/>
<items jcr:primaryType="nt:unstructured">
<!-- Put inputs here -->
</items>
</mycontainer>
</items>
</column>
</items>
</iframe>
</items>
</content>
</jcr:root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment