Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Is there a way to to add reusable parts of dialog under different nodes for different use cases

Avatar

Avatar
Validate 1
Level 1
SebNamek
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
SebNamek
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
SebNamek
Level 1

11-11-2020

Here's my problem I want to reuse my dialog for images using foundation include.

 

My use cases are in one instance I need my node structures to be the following: 

 

component1/cta/images

component2/mobile/images

 

It may be an oversight on my part but I can't seem to find a way that I can include my images dialog under the differing node structure cta or mobile. Is this possible and if so what would I use?

View Entire Topic

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

138 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

138 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

11-11-2020

Hi @SebNamek ,

Hope i understood your requirement, you can create reusable dialog fields at one location & refer same fields from component A, component B etc. using foundation include.

 

Create reusable field at common location (ex: /apps/project-name/widgets/image-field/.content.xml) & add image field in .content.xml

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/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">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<image
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
allowUpload="{Boolean}false"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldDescription="Configure Image"
fieldLabel="Image"
fileNameParameter="./fileName"
fileReferenceParameter="./image"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./file"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>
</items>
</column>
</items>
</jcr:root>

 

In Component A reuse the image field using foundation include:

<items jcr:primaryType="nt:unstructured">
<imageFieldInclude
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
path="/apps/project-name/widgets/image-field/items/column"/>
</items>

 

In Component B reuse the image field using foundation include:

<items jcr:primaryType="nt:unstructured">
<imageFieldInclude
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
path="/apps/project-name/widgets/image-field/items/column"/>
</items>

 

Hope this helps!