Viewlet Manager

« Return to page index

Plone Theme Reference

1. Anatomy of a Viewlet Manager

The bits that go to make up a Viewlet Manager.

Directive in ZCML

<browser:viewletManager />

Attributes in ZCML

name
e.g., [your namespace].[your viewlet manager name]
provides
a marker interface defining what this manager does
layer
a marker interface for your particular theme
class
this will be plone.app.viewletmanager.manager.OrderedViewletManager
permission
in most cases this will be Zope.Public
for
specify an interface marking a group of content types, if you wish. The viewlet manager will then be restricted to those content types
view
specify an interface marking a view, if you wish. The viewlet manager will be restricted to items with those views.

2. Moving, Removing or Hiding a Viewlet Manager

Some hints on moving or hiding viewlet managers.

Viewlet managers are called by page templates. Moving or removing them is simply a case of customizing the template. Most are called by the main_template, but you may also need to look into specific content views for some of them.

Quick Cheat Sheet

Through the Web

  • Site Setup > Zope Management Interface > portal_skins > plone_templates or plone_content
  • Click the Customize button, and look for
    <div tal:replace="structure provider:[viewlet manager name]" />
  • (use the Elements key to identify exactly which manager you're interested in)

In your own product

  • Put your own version of main_template or of the content views in

    [your theme package]/skins.

3. Creating a New Viewlet Manager

A quick cheat sheet for creating a new viewlet manager.

Through the Web

You cannot create a new viewlet manager through the web. To override the order in which viewlets appear in a viewlet manager, use the instructions for viewlets.

In your own product

If you're basing your new viewlet manager on a Plone Default viewlet manager, look up the details in the Elements section of this manual.

You will need to know the name of

Your theme specific interface
This is optional, but ensures that your viewlet is only available for your theme. If you used the plone3_theme paster template, then the name will probably be IThemeSpecific.

You will need to create the following (you should be able to locate the originals to copy by looking them up in the elements section):

browser viewletManager directive
[your theme package]/browser/configure.zcml
Your viewlet manager interface
[your theme package]/browser/interfaces.py
configuration file directives
[your theme package]/profiles/default/viewlets.xml

Sample Interface

from zope.viewlet.interfaces import IViewletManager

class [your viewlet manager interface](IViewletManager):
    """ [A description of your viewlet manager goes here]  """

Sample configure.zcml directive

<browser:viewletManager
 name=[your namespace].[your element name]"
 provides=".interfaces.[your viewlet manager interface]"
 class="plone.app.viewletmanager.manager.OrderedViewletManager"
 layer="[your theme interface]"
 permission="zope2.View"
 />