Skip to content

Commit e1b4aac

Browse files
committed
Refactor section headers in control panel documentation for consistency
1 parent 2a65a79 commit e1b4aac

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ There are two approaches to create a control panel for your Plone add-on:
2424
- manual
2525

2626

27-
## `plonecli`
27+
### `plonecli`
2828

2929
To add a control panel to your add-on, you can use [`plonecli`](https://pypi.org/project/plonecli/) as follows.
3030

@@ -35,7 +35,7 @@ plonecli add controlpanel
3535
This creates the control panel Python file in the control panel's folder where you can define your control panel schema fields.
3636

3737

38-
## Manual
38+
### Manual
3939

4040
To manually create a control panel, go through the following steps.
4141

@@ -44,7 +44,7 @@ To manually create a control panel, go through the following steps.
4444
- Add the control panel to the Plone control panel listing.
4545
- Set default values in the registry.
4646

47-
### Define the settings interface and form
47+
#### Define the settings interface and form
4848

4949
Create a Python module, {file}`mypackage/controlpanel/settings.py`, that defines your control panel's settings interface and form class as follows.
5050

@@ -86,7 +86,7 @@ MyControlPanelView = layout.wrap_form(MyControlPanelForm, ControlPanelFormWrappe
8686
```
8787

8888

89-
### Register the control panel view
89+
#### Register the control panel view
9090

9191
Create a file {file}`mypackage/controlpanel/configure.zcml` with the following content to register the control panel view in ZCML.
9292

@@ -124,7 +124,7 @@ Make sure to include the above file in your package's main {file}`mypackage/conf
124124
</configure>
125125
```
126126

127-
### Add the control panel entry
127+
#### Add the control panel entry
128128

129129
Create a {file}`mypackage/profiles/default/controlpanel.xml` in your package's GenericSetup profile with the following content to add your control panel to the Plone control panel listing.
130130

@@ -165,7 +165,7 @@ These values correspond to the groups in {guilabel}`Site Setup`.
165165
: {guilabel}`Advanced`
166166

167167

168-
### Set default values in the registry
168+
#### Set default values in the registry
169169

170170
Define default values for your settings in {file}`mypackage/profiles/default/registry.xml`.
171171

@@ -182,24 +182,7 @@ Define default values for your settings in {file}`mypackage/profiles/default/reg
182182
```
183183

184184

185-
### Access your settings in code
186-
187-
You can access your settings in Python code as follows.
188-
189-
```python
190-
from plone.registry.interfaces import IRegistry
191-
from zope.component import getUtility
192-
193-
registry = getUtility(IRegistry)
194-
settings = registry.forInterface(IMyControlPanelSettings, prefix="my.addon")
195-
196-
# Now you can access the settings
197-
my_setting_value = settings.my_setting
198-
my_choice_value = settings.my_choice
199-
```
200-
201-
202-
### Register a control panel
185+
#### Register a control panel
203186

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

@@ -266,6 +249,21 @@ make frontend-start
266249

267250
Your control panel should now appear in {guilabel}`Site Setup`.
268251

252+
## Access your settings in code
253+
254+
You can access your settings in Python code as follows.
255+
256+
```python
257+
from plone.registry.interfaces import IRegistry
258+
from zope.component import getUtility
259+
260+
registry = getUtility(IRegistry)
261+
settings = registry.forInterface(IMyControlPanelSettings, prefix="my.addon")
262+
263+
# Now you can access the settings
264+
my_setting_value = settings.my_setting
265+
my_choice_value = settings.my_choice
266+
```
269267

270268
## Use `FieldSet` to group fields
271269

0 commit comments

Comments
 (0)