Skip to content

Commit 47b1792

Browse files
authored
Merge pull request plone#1455 from plone/plone.app.dexterity-init
Prepare for plone.app.dexterity docs
2 parents 742037f + a5e04d5 commit 47b1792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6549
-1
lines changed

docs/backend/behaviors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ A key feature of behaviors is that they allow encapsulating functionality so tha
3434
Overall, behaviors are an important part of the Plone content management system and allow for powerful customization and extensibility of content objects.
3535

3636

37+
(backend-built-in-behaviors-label)=
38+
3739
## Built-in behaviors
3840

3941
To view a complete list of built-in behaviors, browse to {guilabel}`Content Types` control panel, then click {guilabel}`Page` (or any other content type), then {guilabel}`Behaviors`.
File renamed without changes.

docs/backend/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Insert introduction here.
1919
:maxdepth: 2
2020
configuration-registry
2121
control-panels
22-
content-types
22+
content-types/index
2323
behaviors
2424
annotations
2525
vocabularies

docs/contributing/documentation/admins.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,43 @@ This guide is for administrators of Plone Documentation.
1515
It covers automated deployments, hosting, automated testing, previewing, and importing external package documentation into Plone Documentation.
1616

1717

18+
(administrators-import-docs-submodule-label)=
19+
20+
## Importing external docs and converting to MyST
21+
22+
This section describes how to import external projects and convert their docs to MyST.
23+
We did this for `plone.app.dexterity` and several other projects.
24+
25+
1. Create a new branch using the name of the project.
26+
1. Install [rst-to-myst](https://pypi.org/project/rst-to-myst/).
27+
28+
```shell
29+
bin/pip install "rst-to-myst[sphinx]"
30+
```
31+
32+
1. Clone the project repository to the root of `plone/documentation`.
33+
1. Delete any non-documentation files from the clone.
34+
1. Move the documentation files and subfolders to the root of the clone, retaining the documentation structure.
35+
1. Convert the reStructuredText documentation files to MyST.
36+
The example commands below assume that there are files at the root of the clone and in one sub-level of nested directories.
37+
For deeper nesting, insert globbing syntax for each sub-level as `**/`
38+
39+
```shell
40+
bin/rst2myst convert -R project/*.rst
41+
bin/rst2myst convert -R project/**/*.rst
42+
```
43+
44+
1. Add HTML meta data to the converted files.
45+
46+
```shell
47+
cd project
48+
../bin/python ../docs/addMetaData.py
49+
```
50+
51+
1. Optionally clean up any MyST syntax.
52+
1. Commit and push your branch to GitHub and create a pull request.
53+
54+
1855
(administrators-import-docs-submodule-label)=
1956

2057
## Importing external docs with submodules
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "How to find and add behaviors in Plone content types"
5+
"property=og:description": "How to find and add behaviors in Plone content types"
6+
"property=og:title": "How to find and add behaviors in Plone content types"
7+
"keywords": "Plone, content types, behaviors"
8+
---
9+
10+
# Behaviors
11+
12+
This chapter describes how to find and add behaviors.
13+
14+
Dexterity introduces the concept of *behaviors*, which are reusable bundles of functionality or form fields which can be turned on or off on a per-type basis.
15+
16+
Each behavior has a unique interface.
17+
When a behavior is enabled on a type, you will be able to adapt that type to the behavior's interface.
18+
If the behavior is disabled, the adaptation will fail.
19+
The behavior interface can also be marked as an `IFormFieldsProvider`, in which case it will add fields to the standard add and edit forms.
20+
Finally, a behavior may imply a sub-type: a marker interface which will be dynamically provided by instances of the type for which the behavior is enabled.
21+
22+
We will not cover writing new behaviors here, but we will show how to enable behaviors on a type.
23+
Writing behaviors is covered in {doc}`/backend/behaviors`.
24+
25+
In fact, we've already seen one standard behavior applied to our example types, registered in the FTI and imported using GenericSetup.
26+
27+
```xml
28+
<property name="behaviors">
29+
<element value="plone.app.content.interfaces.INameFromTitle" />
30+
</property>
31+
```
32+
33+
Other behaviors are added in the same way, by listing additional behavior interfaces as elements of the `behaviors` property.
34+
35+
Behaviors are normally registered with the `<plone:behavior />` ZCML directive.
36+
When registered, a behavior will create a global utility providing `IBehavior`, which is used to provide some metadata, such as a title and description for the behavior.
37+
38+
You can find and apply behaviors via the {guilabel}`Dexterity Content Types` control panel that is installed with [`plone.app.dexterity`](https://pypi.org/project/plone.app.dexterity/).
39+
For a list of standard behaviors that ship with Plone, see {ref}`backend-built-in-behaviors-label`.

0 commit comments

Comments
 (0)