Midhexe
(midhexe)
February 13, 2023, 6:11am
1
Hi,
In my addon I have some fields in the control panel it is visible in the backend but I can't see them in the frontend Volto, any ideas on fixing it?
class IUserGroupShiftControlPanel(Interface):
group = schema.Choice(
title='Group',
vocabulary='plone.app.vocabularies.Groups',
required=False,
)
users = schema.List(
title=_('Users'),
value_type=schema.Choice(
vocabulary='plone.app.vocabularies.Users'
),
required=False,
)
Backend :
Frontend :
That picture of an empty page on Volto, without even a URL to understand what we're looking at, says nothing.
erral
(Mikel Larreategi)
February 13, 2023, 7:12am
3
To have Control Panels show in Volto, you need to have an special plone.restapi adapter in your addon package.
You can look at the examples provided in bobtemplates.plone. If your control panel is a schema based standard control panel, the adapter is straightforward:
# -*- coding: utf-8 -*-
from {{{ package.dottedname }}} import _
from {{{ package.dottedname }}}.interfaces import I{{{ package.browserlayer }}}
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
from plone.app.registry.browser.controlpanel import RegistryEditForm
from plone.restapi.controlpanels import RegistryConfigletPanel
from plone.z3cform import layout
from zope.component import adapter
from zope.interface import Interface
from zope import schema
class I{{{ controlpanel_name_klass }}}(Interface):
myfield_name = schema.TextLine(
title=_(
"This is an example field for this control panel",
),
description=_(
"",
),
default="",
This file has been truncated. show original
There is a controlpanel subtemplate in bobtemplates.plone that creates all the required boilerplate for you:
stevepiercy
(Steve Piercy)
February 13, 2023, 11:18pm
4
The Plone 6 Documentation when searching for "control panel" in the frontend section might have some more information.
Midhexe
(midhexe)
February 14, 2023, 3:48am
5