PicoPluginInterface
in
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.
Tags
Table of Contents
- getDependants() : array<string|int, object>
- Returns a list of plugins which depend on this plugin
- getDependencies() : array<string|int, string>
- Returns a list of names of plugins required by this plugin
- getPico() : Pico
- Returns the plugin's instance of Pico
- handleEvent() : mixed
- Handles a event that was triggered by Pico
- isEnabled() : bool|null
- Returns a boolean indicating whether this plugin is enabled or not
- isStatusChanged() : bool
- Returns TRUE if the plugin was ever enabled/disabled manually
- setEnabled() : mixed
- Enables or disables this plugin
Methods
getDependants()
Returns a list of plugins which depend on this plugin
public
getDependants() : array<string|int, object>
Return values
array<string|int, object> —dependant plugins
getDependencies()
Returns a list of names of plugins required by this plugin
public
getDependencies() : array<string|int, string>
Return values
array<string|int, string> —required plugins
getPico()
Returns the plugin's instance of Pico
public
getPico() : Pico
Tags
Return values
Pico —the plugin's instance of Pico
handleEvent()
Handles a event that was triggered by Pico
public
handleEvent(string $eventName, array<string|int, mixed> $params) : mixed
Parameters
- $eventName : string
-
name of the triggered event
- $params : array<string|int, mixed>
-
passed parameters
Return values
mixed —isEnabled()
Returns a boolean indicating whether this plugin is enabled or not
public
isEnabled() : bool|null
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.
Tags
Return values
bool|null —plugin is enabled (TRUE) or disabled (FALSE)
isStatusChanged()
Returns TRUE if the plugin was ever enabled/disabled manually
public
isStatusChanged() : bool
Tags
Return values
bool —plugin is in its default state (TRUE), FALSE otherwise
setEnabled()
Enables or disables this plugin
public
setEnabled(bool $enabled[, bool $recursive = true ][, bool $auto = false ]) : mixed
Parameters
- $enabled : bool
-
enable (TRUE) or disable (FALSE) this plugin
- $recursive : bool = true
-
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.
- $auto : bool = false
-
enable or disable to fulfill a dependency. This parameter is optional and defaults to FALSE.