Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

How to use AEM Sling Resource Merger to override an include node

Avatar

Level 1

Hi.

I have a custom component called Banner that is based on a supertype Teaser v2

sling:resourceSuperType="core/wcm/components/teaser/v2/teaser"
 
I am trying to rename field labels to match my custom component needs and for that I am using the AEM Sling Resource Merger.
 
I have been successful in most cases but one - in the core component dialog there is a node that uses /include 
 

 

<link 
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
path="/mnt/overlay/core/wcm/components/commons/editor/dialog/link/v1/link/edit/link"/>

 

 

This /include links into the link dialogue which I believe is this one, although I am not 100% sure since the path is a bit different with /mnt/overlay part.

 

I have tried to use the Sling Resource Merger to override the field label in the correct node structure like this, but that doesn't have any effect. 

 

<link jcr:primaryType="nt:unstructured">
  <link jcr:primaryType="nt:unstructured">
    <items jcr:primaryType="nt:unstructured">
      <url jcr:primaryType="nt:unstructured" fieldLabel="CTA Link"> 
      </url>
    </items>
  </link>
</link>

 

I also tried various permutations without success leading me to a question - Is it even possible to use Sling Resource Merger in this scenario?

 

Thank you for your answers

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @MichaelNeu007 

It is possible to use Sling Resource Merger to override the field label in the link dialog node structure, but the path you are using in your Sling Resource Merger configuration may not be correct.

The path '/mnt/overlay/core/wcm/components/commons/editor/dialog/link/v1/link/edit/link' is the path to the link dialog overlay in the AEM authoring environment. This overlay is used to modify the link dialog for all components that use it, including the Teaser component.

To override the field label for the CTA Link field in the link dialog for your custom Banner component, you will need to use a path that is specific to your component. This path should be based on the `sling:resourceType` of your custom Banner component.

 

1. Create a new node in your custom Banner component's dialog structure that matches the path to the CTA Link field in the link dialog.
<items jcr:primaryType="nt:unstructured">
<url jcr:primaryType="nt:unstructured" fieldLabel="CTA Link">
</url>
</items>

2. In your Sling Resource Merger configuration, specify the path to the node you created in step 1, using the `sling:resourceType` of your custom Banner component. /apps/myapp/components/content/banner/dialog/items/items/url

3. Set the `jcr:mergeProperties` property to `fieldLabel` to indicate that you want to merge the `fieldLabel` property from your custom Banner component's dialog structure with the `fieldLabel` property in the link dialog.

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"
jcr:mergeProperties="fieldLabel">
<items jcr:primaryType="nt:unstructured">
<url jcr:primaryType="nt:unstructured" fieldLabel="CTA Link"/>
</items>
</jcr:root>

 



View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @MichaelNeu007 

It is possible to use Sling Resource Merger to override the field label in the link dialog node structure, but the path you are using in your Sling Resource Merger configuration may not be correct.

The path '/mnt/overlay/core/wcm/components/commons/editor/dialog/link/v1/link/edit/link' is the path to the link dialog overlay in the AEM authoring environment. This overlay is used to modify the link dialog for all components that use it, including the Teaser component.

To override the field label for the CTA Link field in the link dialog for your custom Banner component, you will need to use a path that is specific to your component. This path should be based on the `sling:resourceType` of your custom Banner component.

 

1. Create a new node in your custom Banner component's dialog structure that matches the path to the CTA Link field in the link dialog.
<items jcr:primaryType="nt:unstructured">
<url jcr:primaryType="nt:unstructured" fieldLabel="CTA Link">
</url>
</items>

2. In your Sling Resource Merger configuration, specify the path to the node you created in step 1, using the `sling:resourceType` of your custom Banner component. /apps/myapp/components/content/banner/dialog/items/items/url

3. Set the `jcr:mergeProperties` property to `fieldLabel` to indicate that you want to merge the `fieldLabel` property from your custom Banner component's dialog structure with the `fieldLabel` property in the link dialog.

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"
jcr:mergeProperties="fieldLabel">
<items jcr:primaryType="nt:unstructured">
<url jcr:primaryType="nt:unstructured" fieldLabel="CTA Link"/>
</items>
</jcr:root>

 



Avatar

Level 9

@MichaelNeu007 : I am able to do this on We.Retail site.
Can you please check if in this property you have specified the correct path where you have overridden the field label, for eg:-

 

path="project-name-ex/some-path/link/edit/link"
OR
path="/apps/project-name-ex/some-path/link/edit/link"

 

thanks.

Avatar

Level 1

Hi. Can I see the XML of the override component you created? Did you create an extra include that merges with the core one and pointed to it like the other answers suggest or did you create one just one XML override/merge file?