Documentation

AbstractBehavior extends AutoService
in package
implements BehaviorInterface

AbstractYes

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|null

getDescription()

Optional description of the behavior

public static getDescription() : string|null
Return values
string|null

getKey()

Dashed name, name of entity attribute for selected mode

public static getKey() : string
Return values
string

getTemplate()

Optional template for configuring the behavior in the AfformGuiEditor

public static getTemplate() : string|null
Return values
string|null

        
On this page

Search results