我正在将经典的UI对话框迁移到触摸UI对话框,我已经迁移了父级组件对话框,在观察中发现AEM在子组件中也显示了父级对话框的选项卡和属性。在现有的经典UI对话框中,它不会继承父级属性,而在触摸UI中会。
我们如何通过防止对话框继承来实现与经典UI相同的行为?
如果有人了解此问题,请分享详细信息。
您可以使用 sling:hideChildren
属性来隐藏继承的选项卡和属性。例如,假设您想要隐藏继承的 permissions
和 cloudservices
选项卡,并自定义 basic
和 advanced
选项卡:
...
<items jcr:primaryType="nt:unstructured">
<tabs
...>
<layout
.../>
<items
jcr:primaryType="nt:unstructured"
sling:hideChildren="[permissions,cloudservices]">
<basic
.../>
<advanced
.../>
</items>
</tabs>
</items>
...
将sling:hideChildren属性添加到子组件的对话框中。
您可以将此属性添加到特定字段集/选项卡/字段的直接父级中,以隐藏它们。
语法:
属性名称:sling:hideChildren
属性类型:String或String[]
属性值:立即子元素的名称,“*”表示隐藏所有子元素
示例:
要隐藏以下对话框的属性选项卡下的所有字段:
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured"
sling:hideChildren="*">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>
如果只想隐藏startLevel字段,可以在它的直接父节点上添加sling:hideChildren属性(见下方代码)
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured"
sling:hideChildren="startLevel">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>
请查看AEM 6.1用户界面定制幻灯片9,了解“新”的花岗岩编辑对话框继承...