Expand my Community achievements bar.

SOLVED

How to extend/reuse parsys component

Avatar

Level 1

I have to create a custom component container similar to parsys where i can allow some specific components to be added.

 

let us for example i have created a component called simple where i metioned sling:resourceSuperType is /libs/foundation/components/parsys and this simple component i have added in a page component like <cq:include path = simple resouceType = "myapp/componets/simple" />

 

When i open the page i can not see any editbar then i added the editconfig to the simple component, now i can see the edit bar but if i click new/edit i can not see anything happening.

I can not see the exact behavior like parsys - "edit option and onclick of that list of components pops up where you can select any component and add to parsys".

 

Is there something wrong with my component ?

 

Basically i just want to achieve the following things through component. I am pasting the xml snippet below :

 

<jcr:content

 <simple

 jcr:primaryType="nt:unstructured"

 sling:resourceType="foundation/components/parsys" >

 <component

 jcr:primaryType="nt:unstructured"

 sling:resourceType="myapp/components/....."/>

 <!-- more components here-->

 </simple>

 </jcr:content>

 

Please suggest me how we can achieve this through component.

 

Thanks,

Vipul

1 Accepted Solution

Avatar

Correct answer by
Level 8

The paragraph system is a somewhat complex component to extend because if embeds column control logic within it, and the new paragraph functionality. If you just say overlay parsys.jsp, or copy it's contents into an extension you need to account for specifying the correct new type. parsys.jsp does String newType = resource.getResourceType() + "/new"; to get the new type. Then at the bottom in order to get the new paragraph section to print out they do this - <cq:include path="*" resourceType="<%= newType %>"/>. What that results in is is an absolute reference to the type - /libs/foundation/components/parsys/new. If you say create your own extension at /apps/myapp/components/parsys it will try to include /apps/myapp/components/parsys which doesn't exist. You either has to copy the new component from the parsys to you component. or change the way your generate the new type and simple hard code /libs/foundation/components/parsys/new. Either way works. 

View solution in original post

3 Replies

Avatar

Level 10

Have you tried copying (over laying) the component from libs and placing it in your app (under /apps) as described in this topic:

http://docs.adobe.com/docs/en/cq/current/getting_started/first_steps_for_developers.html

then simply make a few changes to it. Once you know it works - make further changes. 

Avatar

Level 1

I tried the similar way but it did not work for me. Instead of parsys if i extend text or any other component by mentioning sling:resourceSuperType  it worked for me. 

Avatar

Correct answer by
Level 8

The paragraph system is a somewhat complex component to extend because if embeds column control logic within it, and the new paragraph functionality. If you just say overlay parsys.jsp, or copy it's contents into an extension you need to account for specifying the correct new type. parsys.jsp does String newType = resource.getResourceType() + "/new"; to get the new type. Then at the bottom in order to get the new paragraph section to print out they do this - <cq:include path="*" resourceType="<%= newType %>"/>. What that results in is is an absolute reference to the type - /libs/foundation/components/parsys/new. If you say create your own extension at /apps/myapp/components/parsys it will try to include /apps/myapp/components/parsys which doesn't exist. You either has to copy the new component from the parsys to you component. or change the way your generate the new type and simple hard code /libs/foundation/components/parsys/new. Either way works.