4

Today we use a "Multiple registry schema proxy" class to achieve this, but we think there should be a better way to work with tabs at Plone:

https://github.com/collective/collective.nitf/blob/1.x/src/collective/nitf/controlpanel.py#L163-L202

rodfersou
  • 914
  • 6
  • 10

1 Answers1

3

IMO the easiest way to create a configlet with tabs is using plone.supermodel:

from my.package import MessageFactory as _
from plone.supermodel import model
from zope import schema

class IMyConfigletSettings(model.Schema):

    """Schema for the control panel form."""

    field_one = schema.Text(
        title=_(u'Field One'),
        default='',
    )

    model.fieldset('tab_a', label=_(u'Tab A'), fields=['field_a'])

    field_a = schema.Text(
        title=_(u'Field A'),
        default='',
    )

    model.fieldset('tab_b', label=_(u'Tab B'), fields=['field_b'])

    field_b = schema.Text(
        title=_(u'Field B'),
        default='',
    )

This will create a configlet with 3 fields and 3 tabs (one field per tab).

Take a look at the sc.social.like package for a working, real-world example.

Maybe this can be considered the canonical way from now on.

hvelarde
  • 2,875
  • 14
  • 34