Does anyone know how to define a list of components in a template, so when an author creates a page, author can only choose a components from the list?
I tried to put components property in my template called limit as below:
<?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:Template"
jcr:title="Limit Template"
jcr:description="Limit template with predefined components"
allowedPaths="/content(/.*)?"
ranking="{Long}2040">
<jcr:content
cq:designPath="/etc/designs/mysite"
jcr:primaryType="cq:PageContent"
components="[/apps/mysite/components/content/article,/apps/mysite/components/content/button,/apps/mysiten/components/content/image]"
sling:resourceType="mysite/components/pages/limit">
</jcr:content>
</jcr:root>
I see the components property and value in the /mysite/templates/limit/jcr:content. But when I create a page, I didn't see the predefined components.
Thank you for your help.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello,
I think you are updating the property at template jcr:content (as jcr:primaryType shows cq:Template instead nt:unstructured) node which is wrong location because template does not hold the design rules. if you want to update it programmetically then you should update it inside "/etc/designs/mysite/jcr:content" corresponding to your template name. Also remember to draw the correct hierarchy of parsys with proper name so that the rule can match correctly. For more details you can refer geometrixx site design rule heirarchy located at /etc/designs/geometrixx/jcr:content
Thanks,
Pawan
Views
Replies
Total Likes
Hello,
I think you are updating the property at template jcr:content (as jcr:primaryType shows cq:Template instead nt:unstructured) node which is wrong location because template does not hold the design rules. if you want to update it programmetically then you should update it inside "/etc/designs/mysite/jcr:content" corresponding to your template name. Also remember to draw the correct hierarchy of parsys with proper name so that the rule can match correctly. For more details you can refer geometrixx site design rule heirarchy located at /etc/designs/geometrixx/jcr:content
Thanks,
Pawan
Views
Replies
Total Likes
Refer below link and it has some info.
http://docs.adobe.com/docs/en/aem/6-0/author/page-authoring/default-components/designmode.html
Views
Replies
Total Likes
Thank you.
I did look at this option before posted my question. I was looking for alternative way to do it without modifying the file under the /etc/designs. Seems this is the only choice.
Views
Replies
Total Likes
I've used /etc/designs/app/jcr:content/template/parsys but it's not very satisfying. It has to match the template and content structure. So it matter what the parsys is named par, gridpar, col1, etc. Though with Classic UI inheritance worked pretty well so that /etc/designs could be set on one base page, which could hold the config for the other pages with support for nesting and multiple parsys (without explicit configs for each in my experience). It does not work as well in Touch UI. In Touch UI I find it generates a lot of inadvertent 404's on hover for the exact /etc/designs/app/jcr:content node, but somehow it still has the inherited allowed components so authoring works anyway. Maybe I shouldn't say it, but Design Mode and this allowed components thing is my least favorite part of AEM.
Based on https://helpx.adobe.com/experience-manager/kb/HowToDefineComponentListDynamically.html you might try to add a listener. For example in the page component edit config, which I think is probably not recommended.
<?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:listeners jcr:primaryType="cq:EditListenersConfig" updatecomponentlist="function(cell, allowed, componentList){ allowed.push('/libs/cq/tagging/components/tagcloud'); allowed.push('/libs/wcm/foundation/components/text'); allowed.push('wcm/foundation/components/title');
}"/> </jcr:root>
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies