Emitter

Adds event related features to any class.

 trait Winter\Storm\Support\Traits\Emitter

Properties

protected $emitterEventCollection : array

Collection of registered events.

protected $emitterEventSorted : array

Sorted collection of events.

protected $emitterSingleEventCollection : array

Collection of registered events to be fired once only.

Methods

public bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null, integer $priority) : self

Create a new event binding.

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
mixed

when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable

$priority
integer
Returns
self

public bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null) : self

Create a new event binding that fires once only

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
QueuedClosure | Closure | null

When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted

Returns
self

public fireEvent (string $event, array $params = [], boolean $halt = false) : array | mixed | null

Fire an event and call the listeners.

Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

$halt
boolean

Halt after first non-null result

Returns
array | mixed | null

If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.

public unbindEvent (string | array | object $event = null) : self

Destroys an event binding.

Parameters
Property Description
$event
string | array | object

Event to destroy

Returns
self

protected emitterEventSortEvents (string $eventName) : void

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void

protected parseEventAndPayload (mixed $event, mixed $payload = null) : array

Parse the given event and payload and prepare them for dispatching.

Parameters
Property Description
$event
mixed
$payload
mixed
Returns
array

Used by

Class Description
File

File attachment model

Parameter

Parameters model Used for storing internal application parameters.

Revision

Revision history model

User

Administrator user model

UserGroup

Administrator group

UserPreference

All preferences for the backend user

UserRole

Administrator role

UserThrottle

Administrator throttling model

ServerEventDataSource

The server-event data source for the Table widget.

AutoDatasource

Datasource that loads from other data sources automatically

CmsCompoundObject

This is a base class for CMS objects that have multiple sections - pages, partials and layouts.

CmsObject

This is a base class for all CMS objects - content files, pages, partials and layouts.

Content

The CMS content file class.

Layout

The CMS layout class.

Meta

The CMS meta file class, used for interacting with YAML files within the Halcyon datasources

Page

The CMS page class.

Partial

The CMS partial class.

Theme

This class represents the CMS theme.

Group

Group model

Preferences

User Preferences model

Role

Role model

Throttle

Throttle model

User

User model

File

File attachment model

Model

Active Record base class.

DeferredBinding

Deferred Binding Model

Revision

Revision Model

MorphPivot

Reimplementation of \Illuminate\Database\Eloquent\Relations\MorphPivot but extends Winter's Pivot base class instead of Laravel's to get access to Winter magic.

Pivot
Datasource

Datasource base class.

DbDatasource

Database based data source

FileDatasource

File based datasource.

Model

This is a base template object. Equivalent to a Model in ORM.

Mailer

Mailer class for sending mail.

Markdown

Markdown parser.

Copyright © 2024 Winter CMS