Formlib-based content types do not show up in add menu
optilude at gmx.net
Tue Oct 30 22:51:44 UTC 2007
> Plone 3.0.2
> I have been trying to create a very simple content type following optilude's
> directions in The Book. Since I don't need fancy widgets, I was hoping to be
> able to entirely avoid using AT.
My book does not explain how to do non-Archetypes content types.
If you want to do that, you may want to look at oi.plum and/or
borg.project in the Collective.
> After the following I get the possibility
> to create objects from within Clouseau's python prompt, but they're not
> listed anywhere nor do I get them to appear in Plone's add menu.
> 1. Define interface, content type (inheriting from
> 2. Create a factory, declare it as a utility in ZCML
> 3. Create an add view, inheriting from plone.app.form.base.AddForm, declare
> it in a <browser:page zcml directive.
> 4. Declare this menu item:
> title="Add Field container"
> description="Click to add a Field container"
> 5. Create profiles/default/types.xml and
> profiles/default/types/Field_container.xml, where the last contains this
> reference to the factory:
> <property name="content_meta_type">Field container</property>
> <property name="product"></property>
> <property name="factory">FieldContainerFactory</property>
> I can expand on any of the points if needed. A serious problem is that I
> don't find any documentation for this approach.
> Rocky's "use formlib with plone" tutorial says that "add forms cannot easily
> be hooked into Plone as Plone feels it needs to create the content first
> before displaying any forms" (dec 2006).
You can use add forms in Plone 3 - you'll need to look at oi.plum as an
example. The key is that the factory and add view (not same as add menu
item, which IIRC isn't needed) have the same name.
> Does this mean I need to notify "portal_factory" of my new type? Maybe in
> the meanwhile this problem has been solved?
If you use formlib, you can have real add forms. Forget portal_factory
> I would be very grateful for any pointers on how to get unstuck, in fact I
> can turn the hints into documentation if/when I succeed.
Note that this is pretty cutting edge at this point. Some gaps still
exist (e.g. reference engine, standard metadata fields, kupu, inline
validation and editing...), though these will get fixed eventually.
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Product-Developers