AEM6 component allowedChildren not working

橙三吉。 提交于 2019-11-30 05:21:35

问题


Using AEM6 i want to restrict the type of components in a 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.

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.

In AEM6 how can i restrict the type of components in a parsys?


回答1:


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>

The allowedChildren and allowedParents filters are quite complex to use and cannot be combined. I gave up using them in CQ/AEM 5.X



来源:https://stackoverflow.com/questions/25451560/aem6-component-allowedchildren-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!