1

我想隐藏从 /libs/wcm/foundation/components/basicpage/v1/basicpage 继承的某个选项卡中的属性(例如基本选项卡中的 hideInNav 属性)。

此更改应该只影响一个页面渲染组件,因此我不想在 /apps/foundation/components/basicpage/v1/basicpage/tabs/basic 中覆盖 Foundation 页面对话框。因此,我尝试使用 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>
4

1 回答 1

1

好的,想出了一个解决方案(适用于 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>

来自 Adob​​e 的示例。此提交帮助我了解了 6.1 和 6.4 之间的区别: https ://github.com/Adobe-Marketing-Cloud/aem-authoring-extension-page-dialog/commit/aaa6035c8cdfcfaeb5e2157be436e1fccfbe22db

于 2020-08-20T11:47:47.840 回答