Richtext stored in plone.app.registry

This works in both Plone versions:

from plone import api
from plone.autoform import directives as form
from plone.supermodel import model
from zope import schema

IS_PLONE_5 = api.env.plone_version().startswith('5')

class IDisclaimerSettings(model.Schema):
    ...

    if IS_PLONE_5:
        form.widget('text', klass='pat-tinymce')
    else:
        from plone.app.z3cform.wysiwyg import WysiwygFieldWidget
        form.widget('text', WysiwygFieldWidget)
    text = schema.Text(
        title=_(u'Body text'),
        description=_(u'The text of the disclaimer.'),
        required=True,
    )

UPDATE: You can check the pull request on the real package: https://github.com/collective/disclaimer/pull/3/files

2 Likes