-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create a control panel in Plone #4131
Comments
AFAIK, there are contents about the same for a backend addon. However, nothing for doing it here. However, same can be done using 1. First, create your control panel settings interface and form# testcp.py
from zope import schema
from zope.interface import Interface
from plone.app.registry.browser.controlpanel import RegistryEditForm, ControlPanelFormWrapper
from plone.z3cform import layout
class IMyControlPanelSettings(Interface):
my_setting = schema.TextLine(
title=u'My Setting',
description=u'Enter the value for my setting',
required=False,
default=u''
)
my_choice = schema.Choice(
title=u'My Choice',
description=u'Select a value for my choice',
required=False,
default=u'value3',
values=['value1', 'value2', 'value3']
)
class MyControlPanelForm(RegistryEditForm):
schema = IMyControlPanelSettings
schema_prefix = "my.addon"
label = u"My Addon Settings"
MyControlPanelView = layout.wrap_form(MyControlPanelForm, ControlPanelFormWrapper) 2. Register the control panel view in ZCML<!-- controlpanel/browser/configure.zcml -->
<browser:page
name="my-controlpanel"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
class=".testcp.MyControlPanelView"
permission="cmf.ManagePortal" /> 3. Add the control panel entry<!-- profiles/default/controlpanel.xml -->
<configlet
title="My Addon Settings"
action_id="my-controlpanel"
appId="my.addon"
category="plone-general"
condition_expr=""
icon_expr="string:puzzle"
url_expr="string:${portal_url}/@@my-controlpanel"
visible="True">
<permission>Manage portal</permission>
</configlet> 4. Set default values in the registry<!-- profiles/default/registry.xml -->
<records interface="Products.CMFPlone.controlpanel.browser.testcp.IMyControlPanelSettings" prefix="my.addon">
<value key="my_setting">default value</value>
<value key="my_choice">value3</value>
</records> Hope this helps! let me knw if it fails @sneridagh. |
There is documentation in |
Yesterday I found myself trying to create a control panel in Plone and I discovered that there is nothing to be found in https://6.docs.plone.org
I also found this issue: plone/documentation#1304 in the docs repo so it's known since two years ago at least.
I'm opening this issue in here too, in order to raise awareness.
The text was updated successfully, but these errors were encountered: