Skip to content

Instantly share code, notes, and snippets.

@paulrohrbeck
Created March 25, 2014 17:16
Show Gist options
  • Save paulrohrbeck/9766635 to your computer and use it in GitHub Desktop.
Save paulrohrbeck/9766635 to your computer and use it in GitHub Desktop.
Adobe CQ/AEM: Add filter by tag to the query builder (asset share)
<tab4
jcr:primaryType="nt:unstructured"
title="Filter"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<tagFilter
jcr:primaryType="cq:Widget"
name="./tagFilter"
fieldDescription="Add tags to filter the result set."
fieldLabel="Filter by tags"
xtype="tags"/>
</items>
</tab4>
// filter by tags:
String[] tags = properties.get("tagFilter", String[].class);
<%
for (int i = 0; i < tags.length; i++) {
String tag = tags[i];
%>
qb.addHidden("<%=i%>_tag.property", "jcr:content/metadata/cq:tags");
qb.addHidden("<%=i%>_tag.property.1_value", "<%=tag%>");
/* qb.addHidden("<%=i%>_tag.p.or", "true"); */
<%
}
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment