\PicoPluginInterface

Common interface for Pico plugins

For a list of supported events see \DummyPlugin; you can use \DummyPlugin as template for new plugins. For a list of deprecated events see \PicoDeprecated.

If you're developing a new plugin, you MUST both implement this interface and define the class constant API_VERSION. You SHOULD always use the API version of Pico's latest milestone when releasing a plugin. If you're developing a new version of an existing plugin, it is strongly recommended to update your plugin to use Pico's latest API version.

Summary

Methods
Constants
handleEvent()
setEnabled()
isEnabled()
isStatusChanged()
getDependencies()
getDependants()
getPico()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

handleEvent()

handleEvent(string  $eventName, array  $params) 

Handles a event that was triggered by Pico

Parameters

string $eventName

name of the triggered event

array $params

passed parameters

setEnabled()

setEnabled(boolean  $enabled, boolean  $recursive = true, boolean  $auto = false) 

Enables or disables this plugin

Parameters

boolean $enabled

enable (TRUE) or disable (FALSE) this plugin

boolean $recursive

when TRUE, enable or disable recursively. In other words, if you enable a plugin, all required plugins are enabled, too. When disabling a plugin, all depending plugins are disabled likewise. Recursive operations are only performed as long as a plugin wasn't enabled/disabled manually. This parameter is optional and defaults to TRUE.

boolean $auto

enable or disable to fulfill a dependency. This parameter is optional and defaults to FALSE.

Throws

\RuntimeException

thrown when a dependency fails

isEnabled()

isEnabled() : boolean|null

Returns a boolean indicating whether this plugin is enabled or not

You musn't rely on the return value when Pico's onConfigLoaded event wasn't triggered on all plugins yet. This method might even return NULL then. The plugin's status might change later.

Returns

boolean|null —

plugin is enabled (TRUE) or disabled (FALSE)

isStatusChanged()

isStatusChanged() : boolean

Returns TRUE if the plugin was ever enabled/disabled manually

Returns

boolean —

plugin is in its default state (TRUE), FALSE otherwise

getDependencies()

getDependencies() : array<mixed,string>

Returns a list of names of plugins required by this plugin

Returns

array<mixed,string> —

required plugins

getDependants()

getDependants() : array<mixed,object>

Returns a list of plugins which depend on this plugin

Returns

array<mixed,object> —

dependant plugins

getPico()

getPico() : \Pico

Returns the plugin's instance of Pico

Returns

\Pico

the plugin's instance of Pico