Personal tools
You are here: Home Storage Customizing default view and edit forms for content type in Plone

Customizing default view and edit forms for content type in Plone

Posted by Rafal Zawadzki at Jul 03, 2010 06:50 PM |

Plone as CMS provides a lot of magic auto features out of the box. But If you want to change default edit and few forms and you are new to Plone - It could be tricky!

I spent a lot of time search for information how to change default edit and view forms for new content type. All pages which I found were too general, deprecated, not enough detailed etc. So I started digging on my own.

Finally, it is easy (If you know how ;). You have to use portal_skins mechanism, which means that you have to create skins directory in your packages and register it in configure.zcml:

<cmf:registerDirectory directory="skins" name="idoru_skins" recursive="True"/>

And copy to new directory below files (during copying replace base word in name with yourcontenttypename):

Products/Archetypes/skins/archetypes/base_view.pt
Products/Archetypes/skins/archetypes/base_view.pt.metadata
Products/Archetypes/skins/archetypes/base_edit.cpt
Products/Archetypes/skins/archetypes/base_edit.cpt.metadata

for example if you content type is name Place, files should have names:

place_view.pt
place_edit.cpt

and so on..

Last step, set your new templates as default ones, in profiles/default/types/ContentType.xml:

<property name="default_view">place_view</property>
<property name="view_methods">
 <element value="base_view" />
</property>
<alias from="(Default)" to="(dynamic view)" />
<alias from="edit" to="place_edit" />

Now reinstall your product using portal_quickinstaller from ZMI.

Comments (0)