Reference Component In Sightly | Community
Skip to main content
New Participant
February 2, 2016
Solved

Reference Component In Sightly

  • February 2, 2016
  • 3 replies
  • 3018 views

We have to implement the functionality similar to Reference Component but using sightly but with little customization. Default Foundation Component is using sling:include but I have tried using <div data-sly-resource="${item.path @ appendPath='/jcr:content/par/'}" data-sly-unwrap/> and this is returning the data but it is returning the parsys as well. I don't want to include parsys. Is there anything which I can use to achieve this.

If you could check the default reference component,it will return only what is present in the parsys

 

Thanks in advance

Mahesh Karle

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by leeasling

I just put this together and tested it out on Geometrixx Outdoors and it worked perfectly fine.

reference.html

<h3 data-sly-test="${wcmmode.edit || wcmmode.design}">Edit Using Dialog</h3> <sly data-sly-test="${properties.path}" data-sly-resource="${properties.path}"></sly>

dialog.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" height="400" stateful="false" xtype="dialog"> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <reference jcr:primaryType="cq:Panel" title="Reference"> <items jcr:primaryType="cq:WidgetCollection"> <path jcr:primaryType="cq:Widget" fieldLabel="Reference" name="./path" xtype="paragraphreference" /> </items> </reference> </items> </tabs> </items> </jcr:root>

Component Definition

<?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" jcr:primaryType="cq:Component" jcr:title="Reference - Sightly" sling:resourceSuperType="foundation/components/parbase" componentGroup="General" />

3 replies

mvk007Author
New Participant
February 3, 2016

Thanks for quick reply ..Actually I had to copy the same dialog as well. It works now Thanks again

smacdonald2008
New Participant
February 2, 2016

Nice example! 

leeaslingAccepted solution
New Participant
February 2, 2016

I just put this together and tested it out on Geometrixx Outdoors and it worked perfectly fine.

reference.html

<h3 data-sly-test="${wcmmode.edit || wcmmode.design}">Edit Using Dialog</h3> <sly data-sly-test="${properties.path}" data-sly-resource="${properties.path}"></sly>

dialog.xml

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" height="400" stateful="false" xtype="dialog"> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <reference jcr:primaryType="cq:Panel" title="Reference"> <items jcr:primaryType="cq:WidgetCollection"> <path jcr:primaryType="cq:Widget" fieldLabel="Reference" name="./path" xtype="paragraphreference" /> </items> </reference> </items> </tabs> </items> </jcr:root>

Component Definition

<?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" jcr:primaryType="cq:Component" jcr:title="Reference - Sightly" sling:resourceSuperType="foundation/components/parbase" componentGroup="General" />