问题描述
我想隐藏从/ libs / wcm / foundation / components / basicpage / v1 / basicpage继承的某个选项卡中的属性(例如,基本选项卡中的hideInNav属性)。
此更改仅会影响一个页面呈现组件,因此我不希望在/ apps / foundation / components / basicpage / v1 / basicpage /中覆盖基础页面对话框标签/基本。因此,我尝试使用sling:hideChildren,但没有设法使其正常工作。
<?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>
解决方法
好的,找到一个解决方案(针对AEM 6.4)。您必须将资源合并与覆盖一起使用:
对于将继承页面的属性与上级/上级页面的属性进行合并,绝对必须使用覆盖!并且需要绝对路径。
<basic jcr:primaryType="nt:unstructured" path="/mnt/override/apps/[...]/components/basepage/tabs/basic"/>
标签的XML文件可以正常运行,并且可以使用sling:hideChildren和所有其他属性:
<?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>
<moretitles jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured" sling:hideChildren="[pagetitle,navigationtitle,subtitle]"/>
</moretitles>
</items>
</column>
</items>
</jcr:root>
来自Adobe的示例。这个提交帮助我了解了6.1和6.4之间的区别: https://github.com/Adobe-Marketing-Cloud/aem-authoring-extension-page-dialog/commit/aaa6035c8cdfcfaeb5e2157be436e1fccfbe22db