Daniel Roy Greenfeld

Daniel Roy Greenfeld

About | Articles | Books | Jobs | News | Tags

Supplementary views in Plone

This was originally posted on blogger here.

I want to provide several views for certain content types for content loaders to choose from in our project. The suppl_views attribute in the archetype is the place to define these alternate views. So in your content type you have this:

suppl_views = ('my_alternate_view',)

When the content loader goes to modify that particular content via the Plone front end, they could choose 'my_alternate_view' as one of the items under the display tab.

If you want to get fancy you can get this information in code as well:

# returns the supplement views.
MyType.suppl_views
# gets Factory Type Info on the portal type
fti = MyType.getTypeInfo()
# Lists all the views for a type with the default one first.
fti.getAvailableViewMethods(MyType)

Very handy and works in both Plone 2.5x and Plone 3.0x.


Tags: plone legacy-blogger
← Back to home