AbstractBehavior
extends AutoService
in package
implements
BehaviorInterface
Base class for Afform Behaviors
A Behavior is a collection of configuration and functionality for an entity on a form. By implementing the following methods, the Behavior describes which entities it can act on, and what modes it operates in.
The mode selector will automatically appear in the Afform Gui, allowing the user to enable behaviors by selecting a mode.
To enact its functionality, a behavior class can listen to any Civi hook or event.
(e.g. by using EventSubscriberInterface
).
Notable events used by Behaviors include civi.afform.validate
, civi.afform.prefill
and civi.afform.submit
.
Table of Contents
Interfaces
- BehaviorInterface
- An AfformBehavior is a collection of configuration and functionality for an entity on a form.
Methods
- getDefaultMode() : string|null
- Default mode. If set then mode will not be de-selectable.
- getDescription() : string|null
- Optional description of the behavior
- getKey() : string
- Dashed name, name of entity attribute for selected mode
- getTemplate() : string|null
- Optional template for configuring the behavior in the AfformGuiEditor
Methods
getDefaultMode()
Default mode. If set then mode will not be de-selectable.
public
static getDefaultMode() : string|null
Return values
string|nullgetDescription()
Optional description of the behavior
public
static getDescription() : string|null
Return values
string|nullgetKey()
Dashed name, name of entity attribute for selected mode
public
static getKey() : string
Return values
stringgetTemplate()
Optional template for configuring the behavior in the AfformGuiEditor
public
static getTemplate() : string|null