You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/backend/behaviors.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -299,29 +299,32 @@ With add-ons, behaviors can even be enabled even on a single content object or f
299
299
When a behavior is enabled for a particular object, it will be possible to adapt that object to the behavior's interface.
300
300
Otherwise, when the behavior is disabled, adaptation will fail or falls back to a more generic adapter, if any is registered.
301
301
302
-
A behavior is at least a combination of an interface (also as a form field provider), metadata such as a name, title, and description, and sometimes an adapter factory with a marker interface.
303
-
When a behavior is enabled, an interface is added to the content object to indicate its presence - it now provides the interface.
302
+
A behavior is at least a combination of an interface (also as a form field provider); metadata such as a name, title, and description; and sometimes an adapter factory with a marker interface.
303
+
When a behavior is enabled, an interface is added to the content object to indicate its presence.
304
+
In other words, the content object now provides the interface.
304
305
305
306
Behaviors without an adapter factory can be used either as a simple marker or to provide additional form fields.
306
307
In this case, adapting a content object with this interface returns the content object itself, because adapting an object that already provides the exact same interface returns the very same object.
307
-
Based on the now-provided interface, i.e specific views can be registered with the content type, or event handlers can be registered to respond to specific actions.
308
+
Based on the now-provided interface, specific views can be registered with the content type, or event handlers can be registered to respond to specific actions.
308
309
309
-
In other cases, there is also an adapter factory (usually a class), which will be invoked (initialized) to get an appropriate adapter when requested.
310
-
If an adapter factory is used an explicit marker interface is required.
310
+
In other cases, there is also an adapter factory (usually a Python class), which will be invoked (initialized) to get an appropriate adapter when requested.
311
+
If an adapter factory is used, an explicit marker interface is required.
311
312
312
-
With an adapter factory in place, custom getters and setters for form fields can be implemented, or even new methods i.e. for calculations or to combine data can be added.
313
+
With an adapter factory in place, custom getters and setters for form fields can be implemented, or even new methods.
314
+
For example, calculations or the combination of data can be added.
313
315
314
316
### Registration
315
317
316
-
Behaviors are registered globally using the <plone.behavior /> {term}`ZCML` directive.
317
-
Internally, this directive registers a named utility that provides `plone.behavior.interfaces.IBehavior`, which contains combined information about the behavior such as its name, interface, factory/marker interface, and metadata.
318
+
Behaviors are registered globally using the `<plone.behavior />` {term}`ZCML` directive.
319
+
Internally, this directive registers a named utility that provides `plone.behavior.interfaces.IBehavior`.
320
+
This utility contains combined information about the behavior, such as its name, interface, factory or marker interface, and metadata.
318
321
319
322
```{seealso}
320
323
The [README file of `plone.behavior`](https://github.com/plone/plone.behavior/blob/master/README.rst) explains the concepts and different ways to register a behavior in detail.
321
324
```
322
325
323
326
### Lookup and provide
324
327
325
-
Plone content objects have logic to look up the behaviors names registered from their types configuration, the Factory Type Information (FTI).
328
+
Plone content objects have logic to look up the behaviors' names registered from their types' configuration, the Factory Type Information (FTI).
326
329
At runtime, the logic provides the interface (or marker) from the behavior to the object.
327
330
This dynamically provided interface enables the component architecture to react to this new interface by adding additional form fields, bindings events, enabling more specific views, and more.
0 commit comments