Quantcast
Channel: Experiencing Adobe Experience Manager (AEM, CQ)
Viewing all articles
Browse latest Browse all 525

AEM 6520 - AEM Assets add Custom Metadata Columns in Assets Console List View

$
0
0

Goal


Add Custom metadata columns in List view of Assets Consolehttp://localhost:4502/assets.html/

This post adds columns using server side rendering, for adding columns using client side logic check this post

For Custom metadata columns in Search Consolecheck this post

Demo | Package Install | Github


Configure Columns



Columns in List View



Solution


1) Add the custom metadata columns configuration in /apps/dam/gui/content/commons/availablecolumns (Sling Resource Merger combines the otb columns in /libs/dam/gui/content/commons/availablecolumns with ones configured in /apps)

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<eaemTitle
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Title"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
<eaemDesc
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Description"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
<eaemKeywords
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Keywords"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
</jcr:root>


2) Add the following code for rendering metadata values in /apps/dam/gui/coral/components/admin/contentrenderer/row/common/reorder.jsp; include the otb reorder.jsp using cq:include

<%@include file="/libs/granite/ui/global.jsp"%>
<%@ page import="org.apache.sling.api.resource.ValueMap" %>
<%@ page import="org.apache.sling.api.resource.Resource" %>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0"%>

<%
final String ASSET_RES_TYPE = "dam/gui/coral/components/admin/contentrenderer/row/asset";

Resource assetResource = resource;
String eaemTitle = "", eaemDesc = "", eaemKeywords = "";

if(assetResource.getResourceType().equals(ASSET_RES_TYPE)){
ValueMap vm = assetResource.getChild("jcr:content/metadata").getValueMap();

eaemTitle = (String)vm.get("eaemTitle", "");
eaemDesc = (String)vm.get("eaemDesc", "");
eaemKeywords = (String)vm.get("eaemKeywords", "");
}

%>

<td is="coral-table-cell" value="<%= eaemTitle %>">
<%= eaemTitle %>
</td>

<td is="coral-table-cell" value="<%= eaemDesc %>">
<%= eaemDesc %>
</td>

<td is="coral-table-cell" value="<%= eaemKeywords %>">
<%= eaemKeywords %>
</td>

<cq:include script = "/libs/dam/gui/coral/components/admin/contentrenderer/row/common/reorder.jsp"/>


Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>