问题描述
我要使用AEM6来限制parsys中组件的类型。
Using AEM6 i want to restrict the type of components in a parsys.
- 我在页面中有一个parsys。
- 我将自定义组件从侧栏拖动到parsys页面。
- 该自定义组件还具有一个parsys。
- 我可以将侧边栏组件拖到我的组件parsys中。
- 在自定义组件parsys中,所有操作都按预期方式进行,拖放,重新排序,删除。
- I have a parsys in a page.
- i drag a custom component from the sidebar to the parsys page.
- The custom component also has a parsys.
- I can drag sidebar components into my component parsys.
- In the custom component parsys all the operations work as expected, drag, drop, reorder, delete.
在自定义组件中使用allowedChildren和/或allowedParents,子parsys(.content.xml)无效,我可以不限制组件parsys中组件的类型。
Using allowedChildren and / or allowedParents in the custom component and child parsys (.content.xml) has no effect, i can not restrict the type of components in component parsys.
在AEM6中,如何限制parsys中组件的类型?
In AEM6 how can i restrict the type of components in a parsys?
推荐答案
与CQ / AEM 5.X相比,不确定在AEM 6中是否已更改,但是您可以定义设计模式中允许使用的组件。如果您希望使用代码进行此部署,则可以在设计xml中定义:
Not sure if this has changed in AEM 6 compared to CQ/AEM 5.X but you can define which components are allowed within the design mode. If you want to have this deployable with your code you can have the definition in the design xml:
<?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="cq:Page">
<jcr:content
jcr:primaryType="nt:unstructured"
jcr:title="My Design"
sling:resourceType="wcm/core/components/designer">
<mypagecomponent jcr:primaryType="nt:unstructured">
<par jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys"
components="[group:My Group A]">
<section jcr:primaryType="nt:unstructured"/>
<myparcontainer jcr:primaryType="nt:unstructured"
<par jcr:primaryType="nt:unstructured"
sling:resourceType="project/components/myparsys"
components="[group:My Group B]">
<section jcr:primaryType="nt:unstructured"/>
</par>
</myparcontainer>
</par>
</mypagecomponent>
</jcr:content>
</jcr:root>
allowedChildren
和 allowedParents
过滤器使用起来非常复杂,无法结合使用。我放弃了在CQ / AEM 5.X中使用它们
The allowedChildren
and allowedParents
filters are quite complex to use and cannot be combined. I gave up using them in CQ/AEM 5.X
这篇关于允许使用AEM6组件儿童无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!