Skip to content

Commit ac9fc7d

Browse files
Apply suggestions from code review
Co-authored-by: Steve Piercy <web@stevepiercy.com>
1 parent 816824a commit ac9fc7d

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

docs/developer-guide/create-control-panel.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ my_choice_value = settings.my_choice
192192
```
193193

194194

195-
## Register a control panel
195+
### Register a control panel
196196

197197
To manually register a view as a control panel, add the following registration to your {file}`/profiles/default/controlpanel.xml`.
198198

@@ -323,9 +323,10 @@ mypackage/
323323

324324
## REST API compatible control panels
325325

326-
For better integration between backend and Volto, you can create REST API compatible control panels using the adapter pattern. This approach is particularly useful when developing control panels that need to work seamlessly with Volto.
326+
For better integration between backend and Volto, you can create REST API compatible control panels using the adapter pattern.
327+
This approach is particularly useful when developing control panels that need to work seamlessly with Volto.
327328

328-
Create a Python module like `mypackage/controlpanel.py`:
329+
Create a Python module {file}`mypackage/controlpanel.py` as follows.
329330

330331
```python
331332
from plone.restapi.controlpanels import RegistryConfigletPanel
@@ -337,7 +338,7 @@ _ = MessageFactory("mypackage")
337338

338339
@adapter(Interface, Interface)
339340
class MyAddonControlPanel(RegistryConfigletPanel):
340-
"""Volto-compatible REST API control panel for my addon settings."""
341+
"""Volto-compatible REST API control panel for my add-on settings."""
341342

342343
schema = IMyControlPanelSettings
343344
schema_prefix = "my.addon"
@@ -347,7 +348,7 @@ class MyAddonControlPanel(RegistryConfigletPanel):
347348
group = "General"
348349
```
349350

350-
Then register the adapter in your ZCML configuration file:
351+
Then register the adapter in your ZCML configuration file.
351352

352353
```xml
353354
<!-- mypackage/configure.zcml or mypackage/controlpanel/configure.zcml -->
@@ -363,16 +364,26 @@ Then register the adapter in your ZCML configuration file:
363364
</configure>
364365
```
365366

366-
The `group` property in the control panel class corresponds to the control panel category in Volto:
367-
- `General`: General settings (corresponds to `plone-general`)
368-
- `Content`: Content-related settings (corresponds to `plone-content`)
369-
- `Users`: Users and groups settings (corresponds to `plone-users`)
370-
- `Security`: Security settings (corresponds to `plone-security`)
371-
- `Advanced`: Advanced settings (corresponds to `plone-advanced`)
367+
The `group` property in the control panel class corresponds to the control panel category in Volto.
368+
369+
`General`
370+
: General settings (corresponds to `plone-general`)
371+
372+
`Content`
373+
: Content-related settings (corresponds to `plone-content`)
374+
375+
`Users`
376+
: Users and groups settings (corresponds to `plone-users`)
377+
378+
`Security`
379+
: Security settings (corresponds to `plone-security`)
380+
381+
`Advanced`
382+
: Advanced settings (corresponds to `plone-advanced`)
372383

373384
With this approach, your control panel will be automatically available through the REST API at the endpoint `@controlpanels/my-controlpanel`, making it easy to integrate with Volto without additional configuration.
374385

375-
You will still need to set up the registry.xml with default values as described earlier.
386+
You will still need to set up {file}`registry.xml` with default values as described earlier.
376387

377388
```{seealso}
378389
See the chapter {ref}`training:controlpanel-label` from the Mastering Plone 6 Training.

0 commit comments

Comments
 (0)