Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to extend/reuse parsys component

kumarvipul
Level 1
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
Paul_McMahon
Correct answer by
Community Advisor
Community Advisor

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
smacdonald2008
Level 10
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. 

kumarvipul
Level 1
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. 

Paul_McMahon
Correct answer by
Community Advisor
Community Advisor

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