Is it possible to map a single dialog box to multiple JCR properties without using custom widgets?

I have a part of the configuration in my AEM project that I would like to simplify.

The configuration can be changed by two user groups. One requires detailed control over a set of parameters, and the other requires only one.

Instead of writing a custom Ext JS plugin to hide / show fields and add an additional field to switch between normal / simplified mode, I decided to create a separate component for those who are less interested in detailed configuration.

In my dialog.xml, in a fully functional component, I have the following fields:

<field1
    jcr:primaryType="cq:Widget"
    allowBlank="false"
    fieldLabel="Field 1"
    name="./field1"
    xtype="selection"
    type="select"
    options="/bin/myapp/fancyOptions.json" />
<field2
    jcr:primaryType="cq:Widget"
    allowBlank="false"
    fieldLabel="Field 2"
    name="./field2"
    xtype="selection"
    type="select"
    options="/bin/myapp/fancyOptions.json" />
<field3
    jcr:primaryType="cq:Widget"
    allowBlank="false"
    fieldLabel="Field 3"
    name="./field3"
    xtype="selection"
    type="select"
    options="/bin/myapp/fancyOptions.json" />

In the simplified component dialog box, I need only one field:

  • Field

1, 2 3 ( 3 )

Sling , , .

- myComponent
  - field1
  - field2
  - field3

Ext JS ? , , .

+4
1

, . SlingPostServlet @ValueFrom, .

() , HTML :

<field1
    jcr:primaryType="cq:Widget"
    allowBlank="false"
    fieldLabel="Field 1"
    name="./field1"
    xtype="selection"
    type="select"
    options="/bin/myapp/fancyOptions.json" />
<field2
    jcr:primaryType="cq:Widget" 
    xtype="hidden"
    name="./field2@ValueFrom"
    value="./field1"
    defaultValue="./field1" />
<field3 
    jcr:primaryType="cq:Widget" 
    xtype="hidden"
    name="./field3@ValueFrom"
    value="./field1"
    defaultValue="./field1" />

- , value, defaultValue. defaultValue , , , . value .

+2

Source: https://habr.com/ru/post/1649943/


All Articles