Featured

Thursday 21 May 2015

Listeners in cq5 / Configuring the Edit Behaviour of a Component

                
                 The edit behaviour of a component is configured by adding a cq:editConfig node of type cq:EditConfig below the component node (of type cq:Component) and by adding specific properties and child nodes. The following properties and child nodes are available:
  
cq:editConfig node properties: (Can apply these fields & props to editConfit child node)

  • cq:actions (String array):    defines the actions that can be performed on the component.
  • cq:layout (String):    defines how the component is edited.
  • cq:dialogMode (String):    defines how the component dialog is opened.
  • cq:emptyText (String):    defines text that is displayed when no visual content is present.
  • cq:inherit (Boolean):    defines if missing values are inherited from the component that it inherits from.


cq:editConfig child nodes: (Can apply these fields & props to editConfit child node)

  • cq:dropTargets (node type nt:unstructured):    defines a list of drop targets that can accept a drop from an asset of the content finder.
  • cq:actionConfigs (node type nt:unstructured):    defines a list of new actions that are appended to the cq:actions list.
  • cq:formParameters (node type nt:unstructured):    defines additional parameters that are added to the dialog form.
  • cq:inplaceEditing (node type cq:InplaceEditingConfig):    defines an inplace editing configuration for the component.
  • cq:listeners(node type cq:EditListenersConfig):    defines what happens before or after an action occurs on the component.

Note :Node (properties and child nodes) is represented as XML, as shown in the following example.

Applying with cq:EditConfig Properties: 

CQ:ACTIONS

       cq:actions="[edit,-,delete,insert]"
       cq:layout="editbar"
jcr:primaryType="cq:EditConfig"/>

Applying cq:EditConfig Child Nodes 

CQ:DROPTARGETS

<cq:dropTargets jcr:primaryType="nt:unstructured">
  <file
       jcr:primaryType="cq:DropTargetConfig"
       accept="[.*]"
       groups="[media]"
       propertyName="./fileReference"/>
</cq:dropTargets>


Drop targets



CQ:ACTIONCONFIGS

     cq:actions="[EDIT,COPYMOVE,DELETE,INSERT]"
     jcr:primaryType="cq:EditConfig">
           <cq:actionConfigs jcr:primaryType="nt:unstructured">
                               <separator0
                  jcr:primaryType="nt:unstructured"
                  xtype="tbseparator"/>
                                             <manage
                       jcr:primaryType="nt:unstructured"
                       handler="function(){CQ_collab_forum_openCollabAdmin();}"
                       text="Manage comments"/>
         </cq:actionConfigs>
</jcr:root>

CQ:FORMPARAMETERS

<cq:formParameters
   jcr:primaryType="nt:unstructured"
   name="photos/primary"/>

CQ:LISTENERS

<cq:listeners
    jcr:primaryType="cq:EditListenersConfig"
    afterdelete="REFRESH_PAGE"
    afteredit="REFRESH_PAGE"
    afterinsert="REFRESH_PAGE"
    afterMove="REFRESH_PAGE"/>





Source : https://docs.adobe.com/docs/en/cq/5-5/developing/components/edit_config.html



Hope it helps :)
Thanks,
SonyCharan

No comments: