I am dependent on getting a json-structure (or something similar) from an AEM cq-dialog to the DOM of the rendered page, where i pick it up by the rendered page's JS.
The sightly page template looks something like the below, here the data-labels are a json-containing the fields of the dialog. As you see I have manually typed all fields/properties:
<div id="myApp"
data-service="${properties.applicationService}"
data-labels="{"title":"${properties.title}","sub1":"${properties.sub1}","number":"${properties.number}"}"></div>
I rather like to be able to pick up all labels more dynamically: data-labels = ${properties.labels}
Can I get all the "label" properties from the cq-dialog to the template as one property?
My dialog has a couple of fields like below, all the properties on tab1 are considered "label" properties (and hence should be added to the #myApp element's data-labels attribute).
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
title="my Application"
xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<tabs jcr:primaryType="cq:TabPanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Widget"
title="Texts and Labels"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<title
jcr:primaryType="cq:Widget"
fieldDescription="The title of the page."
fieldLabel="blablabla"
name="./title"
defaultValue="default value..."
xtype="textfield"/>
<sub1
jcr:primaryType="cq:Widget"
fieldDescription="First subtitle"
fieldLabel="blablba"
name="./subtitle1"
defaultValue="default value..."
xtype="textfield"/>
<number
jcr:primaryType="cq:Widget"
fieldDescription="The textfield label for number."
fieldLabel="number"
name="./number"
defaultValue="number"
xtype="textfield"/>
</items>
</tab1>
...