Creating Proxy Templates examples
De Basef
AEM's core components provide several basic building blocks for creating content. This includes Text, Image and Title and several other components. These can be included in your project by creating a cq:Component for each one and using the sling:resourceSuperType property to point to the Core Component. This is known as creating proxy components and is the recommended way of using Core Components in your project.
CONTENT FOLDER:
Text Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Rich text content" jcr:title="Text" sling:resourceSuperType="core/wcm/components/text/v2/text"/>
Breadcrumb Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Displays the position of the current page within the site hierarchy" jcr:title="Breadcrumb" sling:resourceSuperType="core/wcm/components/breadcrumb/v2/breadcrumb"/>
List Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Configurable collection of items or content" jcr:title="List" sling:resourceSuperType="core/wcm/components/list/v2/list"/>
Image Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Smart adaptive image" jcr:title="Image" sling:resourceSuperType="core/wcm/components/image/v2/image"/>
Image Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Smart adaptive image" jcr:title="Image" sling:resourceSuperType="core/wcm/components/image/v2/image"/>
Add an cq:EditConfig under the image component:
<?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="cq:EditConfig"> <cq:dropTargets jcr:primaryType="nt:unstructured"> <image jcr:primaryType="cq:DropTargetConfig" accept="[image/.*]" groups="[media]" propertyName="./fileReference"> <parameters jcr:primaryType="nt:unstructured" sling:resourceType="wknd/components/content/image" imageCrop="" imageMap="" imageRotate=""/> </image> </cq:dropTargets> <cq:inplaceEditing jcr:primaryType="cq:InplaceEditingConfig" active="{Boolean}true" editorType="image"> <config jcr:primaryType="nt:unstructured"> <plugins jcr:primaryType="nt:unstructured"> <crop jcr:primaryType="nt:unstructured" features="*"/> <flip jcr:primaryType="nt:unstructured" features="-"/> <map jcr:primaryType="nt:unstructured" features="*"/> <rotate jcr:primaryType="nt:unstructured" features="*"/> <zoom jcr:primaryType="nt:unstructured" features="*"/> </plugins> <ui jcr:primaryType="nt:unstructured"> <inline jcr:primaryType="nt:unstructured" toolbar="[crop#launch,rotate#right,history#undo,history#redo,fullscreen#fullscreen,control#close,control#finish]"> <replacementToolbars jcr:primaryType="nt:unstructured" crop="[crop#identifier,crop#unlaunch,crop#confirm]"/> </inline> <fullscreen jcr:primaryType="nt:unstructured"> <toolbar jcr:primaryType="nt:unstructured" left="[crop#launchwithratio,rotate#right,map#launch,flip#horizontal,flip#vertical,zoom#reset100,zoom#popupslider]" right="[history#undo,history#redo,fullscreen#fullscreenexit]"/> <replacementToolbars jcr:primaryType="nt:unstructured"> <crop jcr:primaryType="nt:unstructured" left="[crop#identifier]" right="[crop#unlaunch,crop#confirm]"/> <map jcr:primaryType="nt:unstructured" left="[map#rectangle,map#circle,map#polygon]" right="[map#unlaunch,map#confirm]"/> </replacementToolbars> </fullscreen> </ui> </config> </cq:inplaceEditing> </jcr:root>
Title Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" componentGroup="WKND.Content" jcr:description="Section header" jcr:title="Title" sling:resourceSuperType="core/wcm/components/title/v2/title"/>
STRUCTURE FOLDER:
Navigation Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" jcr:description="Full-text search" jcr:title="Quick Search" componentGroup="WKND.Structure" sling:resourceSuperType="core/wcm/components/search/v1/search"/>
Search Component Example
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Component" jcr:description="Full-text search" jcr:title="Quick Search" componentGroup="WKND.Structure" sling:resourceSuperType="core/wcm/components/search/v1/search"/>