使用AEM6我想限制parsys中的组件类型.
在自定义组件和子解析(.content.xml)中使用allowedChildren和/或allowedParents没有任何效果,我不能限制组件解析中的组件类型.
在AEM6中,如何限制parsys中的组件类型?
不确定与 CQ/AEM 5.X 相比,AEM 6 中的情况是否有所改变,但您可以定义设计模式中允许使用哪些组件。如果你想在你的代码中部署它,你可以在设计 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>
Run Code Online (Sandbox Code Playgroud)
和过滤器使用起来相当复杂并且无法组合allowedChildren
。allowedParents
我放弃在 CQ/AEM 5.X 中使用它们