Personal tools
You are here: Home Documentation Manuals Plone Core Developer Reference Specific areas Content types Restricting addable types
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

5.1.3. Restricting addable types

Up one level
The constrain-types machinery and how it drives the "restrict..." option under the "add item" menu.

As of Plone 2.1, the "add item" menu supports a "restrict..." page that lets the user decide which items can and cannot be added to that folder. This functionality is defined in a pair of interfaces in CMFPlone.interfaces.constrains, IConstrainTypes for read-only access and ISelectableConstrainTypes for the mutators.

The canonical implementation of these interfaces is in ATContentTypes.lib.constraintypes. This provides storage for the constraint mode (more below) and the list of locally allowed and "preferred" types. The preferred types are the ones that appear in the list immediately, and the rest of the allowed types appear behind a "more..." item.

The constraint type mode can be ACQUIRE (the default), DISABLED or ENABLED. When disabled, the settings in portal_types are used. When enabled, the list of types explicitly set are used. When set to acquire, the parent folder's types will be used if the parent is of the same portal type as the folder in question. If they are of different types the settings in portal_types apply.

The rest of the ConstrainTypesMixin class overrides CMFCore's allowedContentTypes and invokeFactory methods to ensure the constraints are enforced.

by Martin Aspeli last modified April 23, 2008 - 13:28
Contributors: Martin Aspeli, Hanno Schlichting, Whit Morris
All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by