Skip to content

EventBehavior ​

Type
Class
Namespace
craft\behaviors
Inherits
craft\behaviors\EventBehavior » yii\base\Behavior » yii\base\BaseObject
Implements
yii\base\Configurable
Since
4.5.0

Event behavior adds events to an object that will carry on to clones of the owner.

View source

Public Properties ​

PropertyDescription
owneryii\base\Component, null – The owner of this behavior

Public Methods ​

MethodDescription
__call()Calls the named method which is not a class method.
__construct()
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to null.
attach()Attaches the behavior object to the component.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
detach()Detaches the behavior object from the component.
events()
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.

__construct() ​

View source

Arguments ​

  • $events (array<string,callable>) – Event name/handler pairs
  • $once (boolean) – Whether the events should only be handled once for the owner object
  • $config (array)

events() ​

View source