EventBehavior
- Type
- Class
- Namespace
- craft\behaviors
- Inherits
- craft\behaviors\EventBehavior » yii\base\Behavior (opens new window) » yii\base\BaseObject (opens new window)
- Implements
- yii\base\Configurable (opens new window)
- Since
- 4.5.0
Event behavior adds events to an object that will carry on to clones of the owner.
View source (opens new window)
# Public Properties
Property | Description |
---|---|
owner (opens new window) | yii\base\Component (opens new window), null (opens new window) – The owner of this behavior |
# Public Methods
Method | Description |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__construct() | |
__get() (opens new window) | Returns the value of an object property. |
__isset() (opens new window) | Checks if a property is set, i.e. defined and not null. |
__set() (opens new window) | Sets value of an object property. |
__unset() (opens new window) | Sets an object property to null. |
attach() (opens new window) | Attaches the behavior object to the component. |
canGetProperty() (opens new window) | Returns a value indicating whether a property can be read. |
canSetProperty() (opens new window) | Returns a value indicating whether a property can be set. |
className() (opens new window) | Returns the fully qualified name of this class. |
detach() (opens new window) | Detaches the behavior object from the component. |
events() | |
hasMethod() (opens new window) | Returns a value indicating whether a method is defined. |
hasProperty() (opens new window) | Returns a value indicating whether a property is defined. |
init() (opens new window) | Initializes the object. |
# __construct()
View source (opens new window)
Arguments
$events
(array<string,callable>
) – Event name/handler pairs$once
(boolean (opens new window)) – Whether the events should only be handled once for the owner object$config
(array (opens new window))