Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Hide inherited property in page properties dialog (Touch UI)

Avatar

Level 2

I'd like to hide a property within a certain tab that is inherited from /libs/wcm/foundation/components/basicpage/v1/basicpage (e.g. hideInNav property in basic tab).

 

This change should only affect one page-rendering component, so I tried using sling:hideChildren, but did not manage to accomplish it. I also tried this example from Adobe, but it does not work at all.

https://github.com/Adobe-Marketing-Cloud/aem-authoring-extension-page-dialog

 

Any ideas?

1 Accepted Solution

Avatar

Correct answer by
Level 2

I managed to find a solution and actually the example from Adobe works with adjustments

 

You have to use the Sling Resource Merger with /mnt/override and an absolute path to inherit from the parent super component.

<basic jcr:primaryType="nt:unstructured" path="/mnt/override/apps/.../components/basepage/tabs/basic"/>

 

In the XML for the tabs, all properties can be used as expected. For example:

<?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">
<items jcr:primaryType="nt:unstructured">
<title jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured" sling:hideChildren="[hideinnav]" />
</title>
</items>
</column>
</items>
</jcr:root>

 

It is essential to use the Sling Resource Merger with an override and to use an absolute path there! 

View solution in original post

8 Replies

Avatar

Community Advisor

@fraudoudou  
Try using the property sling:hideProperties.

Avatar

Level 2

I also tried this one, but it does not seem to work. I've used these properties before on custom dialogs and they worked fine.

However, I'm trying to do changes to the basic tab from the Foundation page and I have no clue why it's not working here.

 

Can you maybe point me in the right direction because none of the examples below are working?

 

<?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">
<content jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<tabs jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<basic jcr:primaryType="nt:unstructured">

<!-- that does not work either -->
<items jcr:primaryType="nt:unstructured" sling:hideChildren="*">
<column jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<title jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">

<!-- that does not work -->
<title jcr:primaryType="nt:unstructured" sling:hideProperties="*"/>
</items>
</title>

<!-- that does not work -->
<moretitles
cq:showOnCreate="{Boolean}false"
cq:hideOnEdit="{Boolean}true"
jcr:primaryType="nt:unstructured">
</moretitles>
</items>
</column>
</items>
</basic>

<!-- that works -->
<advanced jcr:primaryType="nt:unstructured" sling:hideResource="{Boolean}true"/>
</items>
</tabs>
</items>
</content>
</jcr:root> 

 

Avatar

Level 2
@Nikhil-Kumar Do you have a more detailed example explicitly for targeting properties from an include? I'm having the problem, that I cannot target the property inside the inherited tab, even if I would write a render condition, I'd still need to target that property somehow.

Avatar

Level 2

I managed to find a solution and actually the example from Adobe works with adjustments

 

You have to use the Sling Resource Merger with /mnt/override and an absolute path to inherit from the parent super component.

<basic jcr:primaryType="nt:unstructured" path="/mnt/override/apps/.../components/basepage/tabs/basic"/>

 

In the XML for the tabs, all properties can be used as expected. For example:

<?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">
<items jcr:primaryType="nt:unstructured">
<title jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured" sling:hideChildren="[hideinnav]" />
</title>
</items>
</column>
</items>
</jcr:root>

 

It is essential to use the Sling Resource Merger with an override and to use an absolute path there! 

Avatar

Correct answer by
Level 2

I managed to find a solution and actually the example from Adobe works with adjustments

 

You have to use the Sling Resource Merger with /mnt/override and an absolute path to inherit from the parent super component.

<basic jcr:primaryType="nt:unstructured" path="/mnt/override/apps/.../components/basepage/tabs/basic"/>

 

In the XML for the tabs, all properties can be used as expected. For example:

<?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">
<items jcr:primaryType="nt:unstructured">
<title jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured" sling:hideChildren="[hideinnav]" />
</title>
</items>
</column>
</items>
</jcr:root>

 

It is essential to use the Sling Resource Merger with an override and to use an absolute path there! 

Avatar

Level 2

Hi @fraudoudou 

title override is working but moretitles is not overriding. I tried various permutation and combination but still its not working. Could you please help. I tried to keep at both places

Harsharya_0-1712604060065.png

 

Avatar

Level 1

Hey @Harsharya 

In your screenshot you are using /mnt/overlay with a relative path while for me using /mnt/override along with an absolute path (starting with /apps or /libs) fixed the problem. Did you already happen to try that?