3

I'm developing a custom container component in Adobe CQ5.5 and I'd like to have a custom message as a placeholder instead of the default "Drag components or assets here".

What I found out until now is that I have to add cq:emptyText="My custom placeholder message". Probably I'm missing something as this property gets completely ignored. Here's my component's folder structrure:

  • [clientlib]
  • .content.xml
  • _cq_editConfig.xml
  • dialog.xml
  • myContainer.jsp

According to Adobe's official tutorials and also this wonderful tutorial for building an Accordion container, the cq:emptyText should go into the _cq_editConfig.xml file:

<?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"
    cq:actions="[edit]"
    cq:dialogMode="floating"
    cq:emptyText="Drag My Custom components here"
    jcr:primaryType="cq:EditConfig">
    <cq:listeners
        jcr:primaryType="cq:EditListenersConfig"
        afteredit="REFRESH_PAGE"/>
</jcr:root>

Unfortunately, even with cq:emptyText included I'm still seeing the default placeholder text.

Any help will be highly appreciated!

Thanks!

Stan.


UPDATE:

After Tomek's suggestions, I still get "Drag components or assets here" instead of my custom message so I'm still looking for an answer. My component's file structure now looks like this: - [clientlib] - [new] ---- .content.xml ---- _cq_editConfig.xml - .content.xml - _cq_editConfig.xml - dialog.xml - tabContainer.jsp

.content.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"
    cq:isContainer="{Boolean}true"
    jcr:primaryType="cq:Component"
    jcr:title="Tab Container"
    jcr:description="Container component for tab pages"
    sling:resourceSuperType="foundation/components/parsys"
    componentGroup="MyComponents"/>

_cq_editConfig.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"
    cq:actions="[edit]"
    cq:dialogMode="floating"
    jcr:primaryType="cq:EditConfig">
    <cq:listeners
        jcr:primaryType="cq:EditListenersConfig"
        afteredit="REFRESH_PAGE"/>
</jcr:root>

new/.content.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"
    jcr:primaryType="cq:Component"
    jcr:title="New Paragraph"
    sling:resourceType="foundation/components/parsys/new"
    componentGroup=".hidden"/>

new/_cq_editConfig.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"
    cq:actions="[_clear,insert]"
    cq:emptyText="Drag My Custom components here"
    jcr:primaryType="cq:EditConfig" />
diffa
  • 2,986
  • 1
  • 22
  • 35
Stan
  • 1,251
  • 1
  • 15
  • 24

2 Answers2

4

As you're implementing parsys, you need following structure, as Tomek Rękawek suggested:

.content.xml (the important part here is the resourceSuperType)

<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"
    cq:isContainer="{Boolean}true"
    jcr:primaryType="cq:Component"
    jcr:title="Your title"
    sling:resourceSuperType="foundation/components/parsys" />

new/.content.xml

<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="New Paragraph"
    sling:resourceType="foundation/components/parsys/new"
    componentGroup=".hidden"/>

new/_cq_editConfig.xml (this is where you would want to set the cq:emptyText attribute)

<?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"
    cq:actions="[_clear,insert]"
    cq:emptyText="Drag My Custom components here"
    jcr:primaryType="cq:EditConfig"/>

At this moment I was not getting the "Drag My Custom components here" text on the component placeholder. What did the trick for me was to create new/new.jsp with following content:

new/new.jsp

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
%><%@include file="/libs/foundation/global.jsp"
%><%@ page session="false" import="
    com.day.cq.wcm.api.components.EditContext" %><%

    editContext.getEditConfig().setEmpty(true);
%>

Then I was able to see the empty text I set in new/_cq_editConfig.xml. I've tested this on CQ5.6.

Hope this helps.

  • Thanks for the reply! I added the new/new.jsp but with still no effect :-(. I'm running on 5.6.1 which means that maybe there is a setting somewhere that might have to be turned on. I'm using the exact same files as you do, but no result. – Stan Oct 11 '13 at 20:10
  • @stan, I'm running 5.6.1 this answer does worked for me – santiagozky Feb 18 '14 at 14:08
  • As I said, there might be something else that is preventing me from showing that text and eventually I stopped trying. – Stan Feb 24 '14 at 19:32
2

This container is usually called paragraph system or parsys. You should have structure like this:

.content.xml

<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"
    cq:isContainer="{Boolean}true"
    jcr:primaryType="cq:Component"
    jcr:title="Your title"
    sling:resourceSuperType="foundation/components/parsys" />

new/.content.xml

<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="New Paragraph"
    sling:resourceType="foundation/components/parsys/new"
    componentGroup=".hidden"/>

new/_cq_editConfig.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"
    cq:actions="[_clear,insert]"
    cq:emptyText="Drag My Custom components here"
    jcr:primaryType="cq:EditConfig"/>

So, you need to create new subdirectory to your component and the property should be added to the file new/_cq_editConfig.xml.

Tomek Rękawek
  • 9,204
  • 2
  • 27
  • 43
  • Thanks for the reply Tomek. I did everything you suggested but I still see only the default "Drag your components or assets here". See my updates above for more info, I can't put everything here. – Stan Oct 08 '13 at 14:39