WidgetEvent
API reference › yii › base › WidgetEvent
WidgetEvent represents the event parameter used for a widget event.
By setting the $isValid property, one may control whether to continue running the widget.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$data | mixed | The data that is passed to Component::on() when attaching an event handler. Default: null. | Event |
$handled | bool | Whether the event is handled. Default: false. | Event |
$isValid | bool | Whether to continue running the widget. Default: true. | WidgetEvent |
$name | string | The event name. Default: null. | Event |
$result | mixed | The widget result. Default: null. | WidgetEvent |
$sender | object| | The sender of this event. Default: null. | Event |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | BaseObject |
__call() | Calls the named method which is not a class method. | BaseObject |
__get() | Returns the value of an object property. | BaseObject |
__isset() | Checks if a property is set, i.e. defined and not null. | BaseObject |
__set() | Sets value of an object property. | BaseObject |
__unset() | Sets an object property to null. | BaseObject |
canGetProperty() | Returns a value indicating whether a property can be read. | BaseObject |
canSetProperty() | Returns a value indicating whether a property can be set. | BaseObject |
className() static | Returns the fully qualified name of this class. | BaseObject |
hasHandlers() static | Returns a value indicating whether there is any handler attached to the specified class-level event. | Event |
hasMethod() | Returns a value indicating whether a method is defined. | BaseObject |
hasProperty() | Returns a value indicating whether a property is defined. | BaseObject |
init() | Initializes the object. | BaseObject |
off() static | Detaches an event handler from a class-level event. | Event |
offAll() static | Detaches all registered class-level event handlers. | Event |
on() static | Attaches an event handler to a class-level event. | Event |
trigger() static | Triggers a class-level event. | Event |
Property details
Section titled “Property details”$isValid
Section titled “$isValid ”public bool $isValid = trueWhether to continue running the widget.
Event handlers of
Widget::EVENT_BEFORE_RUN may set this property to decide whether
to continue running the current widget.
$result
Section titled “$result ”public mixed $result = nullThe widget result.
Event handlers may modify this property to change the widget result.