I have two templates. The first has a parsys with the path article, the second has a parsys with the path parsys.
I have a custom component. I have set the allowedParents attribute on the jcr:root node in .content.xml to:
allowedParents="[*/article]"
I am allowed to add this component to any parsys across my site, regardless of path. This does not seem to be the correct behaviour - it's certainly not expected. What am I doing wrong?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Actually, allowedParents and allowedChildren are meant to be used on Templates only; to achieve those kind of restrictions on Component level, we should leverage the design mode instead.
Regards,
Christian.
Views
Replies
Total Likes
The allowedParents property is an array of paths to the components where defining component can be used. In my understanding, it is not the component name in the page that is defined but the component type. If you do not have a component type that is called /apps/something/something/article then I don't think that is would work.
What we have done, when we want paragraps that has restricted set of allowed children is one of two things.
1. Define the allowedChildren in the parent type definition such as a paragraph.
2. Create a new type of component that only in name override the parent.
One example of the first is when we want a Fact Summary Page to have either Corporate Facts Page, Historic Facts Page or Fun Facts Page as a child. They are all based on the Page Component Fact Page but contains different default sets of text and image components.
allowedParents="[/apps/mysite/templates/facts/corporate_facts_page,/apps/mysite/templates/facts/historic_facts_page,/apps/mysite/templates/facts/fun_facts_page, /apps/mysite/components/pages/facts_page]">
An example of the later is when we have the Product page wher we in the paragraph either could do as in case 1, but then have to release a new version every time we add a component that is "Product aware" (and that sux). So what we did was that we created the component /apps/mysite/components/productpar that only has the parsys as the supertype. This makes it possible for us to define the allowedParent="[*/productpar]" in all our product aware components. Then we don't really need to know what that product paragraph is called in the page.
Did this help??
/Ove
Update to this thread: Please note that the allowedParents/allowedChildren properties should only be applied on Templates (not on Components).
Views
Replies
Total Likes
Hi,
Actually, allowedParents and allowedChildren are meant to be used on Templates only; to achieve those kind of restrictions on Component level, we should leverage the design mode instead.
Regards,
Christian.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies