API_VERSION
API_VERSION
API version used by this plugin
Pico dummy plugin - a template for plugins
You're a plugin developer? This template may be helpful :-) Simply remove the events you don't need and add your own logic.
$pico : \Pico
Current instance of Pico
__construct(\Pico $pico)
Constructs a new instance of a Pico plugin
\Pico | $pico | current instance of Pico |
setEnabled(boolean $enabled, boolean $recursive = true, boolean $auto = false) : void
Enables or disables this plugin
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. |
getPico() : \Pico
Returns the plugins instance of Pico
the plugins instance of Pico
getPluginConfig(string $configName = null, mixed $default = null) : mixed
Returns either the value of the specified plugin config variable or the config array
string | $configName | optional name of a config variable |
mixed | $default | optional default value to return when the named config variable doesn't exist |
if no name of a config variable has been supplied, the plugin's config array is returned; otherwise it returns either the value of the named config variable, or, if the named config variable doesn't exist, the provided default value or NULL
onPluginsLoaded(array<mixed,object> $plugins) : void
Triggered after Pico has loaded all available plugins
This event is triggered nevertheless the plugin is enabled or not. It is NOT guaranteed that plugin dependencies are fulfilled!
array<mixed,object> | $plugins | loaded plugin instances |
onSinglePageLoading(string $id, boolean|null $skipPage) : void
Triggered before Pico loads a single page
Set the $skipFile
parameter to TRUE to remove this page from the pages
array. Pico usually passes NULL by default, unless it is a conflicting
page (i.e. content/sub.md
, but there's also a content/sub/index.md
),
then it passes TRUE. Don't change this value incautiously if it isn't
NULL! Someone likely set it to TRUE or FALSE on purpose...
string | $id | relative path to the content file |
boolean|null | $skipPage | set this to TRUE to remove this page from the pages array, otherwise leave it unchanged |
onSinglePageContent(string $id, $rawContent) : void
Triggered when Pico loads the raw contents of a single page
Please note that this event isn't triggered when the currently processed page is the requested page. The reason for this exception is that the raw contents of this page were loaded already.
string | $id | relative path to the content file |
$rawContent |
onSinglePageLoaded(array $pageData) : void
Triggered when Pico loads a single page
The $pageData
parameter consists of the following values:
Array key | Type | Description |
---|---|---|
id | string | relative path to the content file |
url | string | URL to the page |
title | string | title of the page (YAML header) |
description | string | description of the page (YAML header) |
author | string | author of the page (YAML header) |
time | string | timestamp derived from the Date header |
date | string | date of the page (YAML header) |
date_formatted | string | formatted date of the page |
hidden | bool | this page shouldn't be visible to the user |
raw_content | string | raw, not yet parsed contents of the page |
meta | string | parsed meta data of the page |
previous_page | &array | reference to the previous page |
next_page | &array | reference to the next page |
Please note that the previous_page
and next_page
keys won't be
available until the onCurrentPageDiscovered
event was triggered.
Set $pageData
to NULL to remove this page from the pages array.
array | $pageData |
onPagesDiscovered(array $pages) : void
Triggered after Pico has discovered all known pages
See \DummyPlugin::onSinglePageLoaded() for details about the structure of the page data. Please note that the pages array isn't sorted yet.
array | $pages |
onPagesLoaded(array $pages) : void
Triggered after Pico has sorted the pages array
See \DummyPlugin::onSinglePageLoaded() for details about the structure of the page data.
array | $pages |
onCurrentPageDiscovered(array $currentPage = null, array $previousPage = null, array $nextPage = null) : void
Triggered when Pico discovered the current, previous and next pages
See \DummyPlugin::onSinglePageLoaded() for details about the structure of the page data.
array | $currentPage | |
array | $previousPage | |
array | $nextPage |
checkCompatibility() : void
Checks compatibility with Pico's API version
Pico automatically adds a dependency to \PicoDeprecated when the plugin's API is older than Pico's API. \PicoDeprecated furthermore throws a exception when it can't provide compatibility in such cases. However, we still have to decide whether this plugin is compatible to newer API versions, what defaults to "no" by default.
thrown when the plugin's and Pico's API aren't compatible