[Product-Developers] How to tell a type it is only addable to a certain type

Hedley Roos hedley at upfrontsystems.co.za
Mon Sep 29 11:51:57 UTC 2008


Make sure global_allow is False in profiles/default/types/YourType.xml

Let's say you want YourType to be addable to Folders. Go to ZMI, 
portal_types, Folder and adjust Allowed Content Types to include 
YourType. You may want to do this programatically.

If, however, you want YourType to be addable to only a single folder and 
not all folders, then this piece of code will do that.

folder.setConstrainTypesMode(1)
folder.setLocallyAllowedTypes('YourType')

This overrides the allowed types for a single instance of Folder.

Hope that helps
Hedley

kkrieger wrote:
> I have a custom type. I want to set some kind of preference for that type, so
> that it is only addable to one certain other type and it shall not appear in
> the "Add" menu of any other type (folder, news, whatever).
> How can I do this? I have been playing with the XML-File of my type but I
> didnt have any success so far. Help is much appreciated!
> 
> Katrin





More information about the Product-Developers mailing list