6

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 Answers1

3

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

Thomas
  • 6,325
  • 4
  • 30
  • 65
  • This approach no longer seems to work in AEM6 -> design mode is no longer present and even when sent in the design xml it doesn't seem to apply. – James Lelyveld Aug 26 '14 at 11:30
  • You need to switch to the classic UI for the design mode. And you also need to have the cq:designPath set on one of the parent pages. Check geometrixx for example. – Thomas Aug 26 '14 at 12:57
  • Yeah - I've done both of those, used this extensively in 5.5 & 5.6.1 - but the same mechanism doesn't seem to work in AEM 6. With the setting the allowed components isn't restricted – James Lelyveld Aug 26 '14 at 14:11
  • 4
    This is the correct way of doing it. but there is a bug in AEM6 that allows parsys to accept any component. You'll have to live with it until solved by adobe – santiagozky Sep 02 '14 at 13:18
  • 1
    [AEM6 SP2](http://docs.adobe.com/docs/en/aem/6-0/release-notes-sp2.html) says the following in the release notes: "Fixed issue with allowed component list not being respected for parsys (and nested parsys). CQ-25520, CQ-27415" so this _may_ be fixed. Not tested yet. – diffa Feb 27 '15 at 09:04
  • I think I am running into the same issue (on AEM6 SP2). Was anyone able to resolve this? The release notes above are for "Touch-optimized Page Authoring" so I am not sure if that applies to the Classic UI or not. – Sagar Sane Aug 05 '15 at 18:02
  • I'm still having this issue – fanta Jan 19 '16 at 17:17