AEM6组件允许孩子不工作

Ale*_*ras 6 aem

使用AEM6我想限制parsys中的组件类型.

  • 我在页面中有一个parsys.
  • 我将自定义组件从侧边栏拖到parsys页面.
  • 自定义组件也有一个parsys.
  • 我可以将侧边栏组件拖到我的组件解析中.
  • 在自定义组件中,所有操作都按预期工作,拖放,重新排序,删除.

在自定义组件和子解析(.content.xml)中使用allowedChildren和/或allowedParents没有任何效果,我不能限制组件解析中的组件类型.

在AEM6中,如何限制parsys中的组件类型?

Tho*_*mas 3

不确定与 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)

和过滤器使用起来相当复杂并且无法组合allowedChildrenallowedParents我放弃在 CQ/AEM 5.X 中使用它们

  • 这是正确的做法。但 AEM6 中存在一个错误,允许 parsys 接受任何组件。在 adobe 解决之前,你必须忍受它 (4认同)