cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict custom aspect to specific mimetype or cm:content type

leonardo_celati
Champ in-the-making
Champ in-the-making
Is there a way to restrict a custom aspect to only being applied to a node of type cm:content, or better to a specific mimetype ?

It would be great if this could be specified directly in the mycustom-model.xml.
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
you could add a policy that prevents the aspect being added to unwanted types or mimetypes.   There's nothing in the model that will prevent aspects being added.

leonardo_celati
Champ in-the-making
Champ in-the-making
From the "policy" point of view, what's the best practice for preventing the aspect from being added to unwanted situation ?

Actually, I am just throwing an error on relevant policy methods onAddAspect, onBefore.. etc. This is preventing the aspect from being added, but the user is getting a standard message. So, the questions in detail:

I mean:

<ul>
<li>Are there any alternatives other than throwing a runtime error in policy method ?</li>
<li>If not, I am completely missing how can I customize the error message</li>
</ul>