BehaviorInterface
in
An AfformBehavior is a collection of configuration and functionality for an entity on a form.
Note: Rather than implementing this interface directly, extend the AbstractBehavior class.
Table of Contents
Methods
- getAttributes() : array<string|int, mixed>
- Array of attributes added to the entity by this behavior.
- getDefaultMode() : string|null
- Default mode. If set then mode will not be de-selectable.
- getDescription() : string|null
- Optional description of the behavior
- getEntities() : array<string|int, mixed>
- Return list of supported Afform entities (e.g. Individual, Household...)
- getKey() : string
- Dashed name, name of entity attribute for selected mode
- getModes() : array<string|int, mixed>
- Get array of modes for a given entity
- getTemplate() : string|null
- Optional template for configuring the behavior in the AfformGuiEditor
- getTitle() : string
- Title of the behavior
Methods
getAttributes()
Array of attributes added to the entity by this behavior.
public
static getAttributes() : array<string|int, mixed>
Array is keyed by attribute name, with a value of an ArrayHtml data type, e.g.
[
'my-mode' => 'text',
'my-config-data' => 'js',
]
Return values
array<string|int, mixed>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|nullgetEntities()
Return list of supported Afform entities (e.g. Individual, Household...)
public
static getEntities() : array<string|int, mixed>
Return values
array<string|int, mixed>getKey()
Dashed name, name of entity attribute for selected mode
public
static getKey() : string
Return values
stringgetModes()
Get array of modes for a given entity
public
static getModes(string $entityName) : array<string|int, mixed>
The mode determines whether this behavior is enabled and what it should do
Parameters
- $entityName : string
-
Only matters if this behavior supports multiple entities and if the modes are different
Return values
array<string|int, mixed>getTemplate()
Optional template for configuring the behavior in the AfformGuiEditor
public
static getTemplate() : string|null
Return values
string|nullgetTitle()
Title of the behavior
public
static getTitle() : string