LimeSurvey API - Master branch

PluginEvent
in package

Table of Contents

Properties

$_content  : array<string|int, mixed>
This array holds the content blocks that plugins generate, idexed by plugin name
$_event  : string
The name of this event
$_parameters  : array<string|int, mixed>
Internal storage for event data. Can be used to communicate between sender and plugin or between different plugins handling the event.
$_sender  : object
The class who fired the event, or null when not set
$_stop  : bool
When true it prevents delegating the event to other plugins.

Methods

__construct()  : PluginEvent
Constructor for the PluginEvent
append()  : PluginEvent
Appends a new value into the old.
get()  : mixed
Get a value for the given key.
getAllContent()  : array<string|int, PluginEventContent>
Return an array of pluginname / PluginEventContent but only when it has content
getContent()  : PluginEventContent
Returns content for the given plugin(name)
getEventName()  : string
Return the name of the event
getSender()  : object
Return the sender of the event
isStopped()  : bool
Returns true when execution of this event was stopped using $this->stop()
set()  : PluginEvent
Set a key/value pair to be used by plugins hanlding this event.
setContent()  : PluginEventContent
Set content for $plugin, replacing any preexisting content
stop()  : mixed
Halt execution of this event by other plugins

Properties

$_content

This array holds the content blocks that plugins generate, idexed by plugin name

protected array<string|int, mixed> $_content = array()

of PluginEventContent

$_event

The name of this event

protected string $_event = ''

$_parameters

Internal storage for event data. Can be used to communicate between sender and plugin or between different plugins handling the event.

protected array<string|int, mixed> $_parameters = array()

$_sender

The class who fired the event, or null when not set

protected object $_sender = null

$_stop

When true it prevents delegating the event to other plugins.

protected bool $_stop = false

Methods

__construct()

Constructor for the PluginEvent

public __construct(string $event[, object $sender = null ]) : PluginEvent
Parameters
$event : string

Name of the event fired

$sender : object = null

The object sending the event

Return values
PluginEvent

append()

Appends a new value into the old.

public append(string $key, array<string|int, mixed> $value) : PluginEvent

$value has to be an array in this case, since it is assumed that old value was an array. The new and old array value will be merged.

Parameters
$key : string
$value : array<string|int, mixed>
Return values
PluginEvent

Fluent interface

get()

Get a value for the given key.

public get([string $key = null ][, mixed $default = null ]) : mixed

When the value is not set, it will return the given default or null when no default was given.

Parameters
$key : string = null
$default : mixed = null

getContent()

Returns content for the given plugin(name)

public getContent(PluginBase|string $plugin) : PluginEventContent

When there is no content yet, it will return an empty content object.

Parameters
$plugin : PluginBase|string

The plugin we want content for or a string name

Return values
PluginEventContent

getEventName()

Return the name of the event

public getEventName() : string
Return values
string

getSender()

Return the sender of the event

public getSender() : object

Normally the class that fired the event, but can return false when not set.

Return values
object

The object sending the event, or false when unknown

isStopped()

Returns true when execution of this event was stopped using $this->stop()

public isStopped() : bool
Return values
bool

set()

Set a key/value pair to be used by plugins hanlding this event.

public set(string $key, mixed $value) : PluginEvent
Parameters
$key : string
$value : mixed
Return values
PluginEvent

Fluent interface

setContent()

Set content for $plugin, replacing any preexisting content

public setContent(string|PluginBase $plugin[, string $content = null ][, string $cssClass = null ][, string $id = null ]) : PluginEventContent
Parameters
$plugin : string|PluginBase

The plugin setting the context or a string name

$content : string = null
$cssClass : string = null
$id : string = null
Return values
PluginEventContent

stop()

Halt execution of this event by other plugins

public stop() : mixed

        
On this page

Search results