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
$enabled : boolean|null
This plugin is disabled by default
Usually you should remove this class property (or set it to NULL) to leave the decision whether this plugin should be enabled or disabled by default up to Pico. If all the plugin's dependenies are fulfilled (see \DummyPlugin::$dependsOn), Pico enables the plugin by default. Otherwise the plugin is silently disabled.
If this plugin should never be disabled silently (e.g. when dealing with security-relevant stuff like access control, or similar), set this to TRUE. If Pico can't fulfill all the plugin's dependencies, it will throw an RuntimeException.
If this plugin rather does some "crazy stuff" a user should really be aware of before using it, you can set this to FALSE. The user will then have to enable the plugin manually. However, if another plugin depends on this plugin, it might get enabled silently nevertheless.
No matter what, the user can always explicitly enable or disable this plugin in Pico's config.
__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)
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. |
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.
plugin is enabled (TRUE) or disabled (FALSE)
getPico() : \Pico
Returns the plugin's instance of Pico
the plugin's 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
getDependencies() : array<mixed,string>
Returns a list of names of plugins required by this plugin
required plugins
None found |
getDependants() : array<mixed,object>
Returns a list of plugins which depend on this plugin
dependant plugins
None found |
onPluginsLoaded(array<mixed,object> $plugins)
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 |
None found |
onPluginManuallyLoaded(object $plugin)
Triggered when Pico manually loads a plugin
object | $plugin | loaded plugin instance |
None found |
onConfigLoaded(array $config)
Triggered after Pico has read its configuration
array | $config |
None found |
None found |
onThemeLoaded(string $theme, integer $themeApiVersion, array $themeConfig)
Triggered after Pico loaded its theme
string | $theme | name of current theme |
integer | $themeApiVersion | API version of the theme |
array | $themeConfig |
None found |
onRequestUrl( $url)
Triggered after Pico has evaluated the request URL
$url |
None found |
onRequestFile( $file)
Triggered after Pico has discovered the content file to serve
$file |
None found |
None found |
None found |
on404ContentLoaded( $rawContent)
Triggered after Pico has read the contents of the 404 file
$rawContent |
None found |
onContentLoaded( $rawContent)
Triggered after Pico has read the contents of the file to serve
If Pico serves a 404 file, this event is triggered with the raw contents of said 404 file. Use \Pico::is404Content() to check for this case when necessary.
$rawContent |
None found |
None found |
onMetaParsed(array $meta)
Triggered after Pico has parsed the meta header
array | $meta |
None found |
None found |
onContentPrepared( $markdown)
Triggered after Pico has prepared the raw file contents for parsing
$markdown |
None found |
onContentParsed( $content)
Triggered after Pico has parsed the contents of the file to serve
$content |
None found |
None found |
onSinglePageLoading(string $id, boolean|null $skipPage)
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 |
None found |
onSinglePageContent(string $id, $rawContent)
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 |
None found |
onSinglePageLoaded(array $pageData)
Triggered when Pico loads a single page
Please refer to \Pico::readPages() for information about the structure of a single page's data.
array | $pageData |
None found |
onPagesDiscovered(array $pages)
Triggered after Pico has discovered all known pages
Pico's pages array isn't sorted until the onPagesLoaded
event is
triggered. Please refer to \Pico::readPages() for information
about the structure of Pico's pages array and the structure of a single
page's data.
array | $pages |
None found |
onPagesLoaded(array $pages)
Triggered after Pico has sorted the pages array
Please refer to \Pico::readPages() for information about the structure of Pico's pages array and the structure of a single page's data.
array | $pages |
None found |
onCurrentPageDiscovered(array $currentPage = null, array $previousPage = null, array $nextPage = null)
Triggered when Pico discovered the current, previous and next pages
If Pico isn't serving a regular page, but a plugin's virtual page, there will neither be a current, nor previous or next pages. Please refer to \Pico::readPages() for information about the structure of a single page's data.
array | $currentPage | |
array | $previousPage | |
array | $nextPage |
None found |
onPageTreeBuilt(array $pageTree)
Triggered after Pico built the page tree
Please refer to \Pico::buildPageTree() for information about the structure of Pico's page tree array.
array | $pageTree |
None found |
onPageRendering( $templateName, array $twigVariables)
Triggered before Pico renders the page
$templateName | ||
array | $twigVariables |
None found |
onPageRendered( $output)
Triggered after Pico has rendered the page
$output |
None found |
onMetaHeaders(array $headers)
Triggered when Pico reads its known meta header fields
array | $headers |
None found |
onYamlParserRegistered(\Symfony\Component\Yaml\Parser $yamlParser)
Triggered when Pico registers the YAML parser
\Symfony\Component\Yaml\Parser | $yamlParser |
None found |
onParsedownRegistered(\Parsedown $parsedown)
Triggered when Pico registers the Parsedown parser
\Parsedown | $parsedown |
None found |
onTwigRegistered(\Twig_Environment $twig)
Triggered when Pico registers the twig template engine
\Twig_Environment | $twig |
None found |
None found |
checkDependencies(boolean $recursive)
Enables all plugins which this plugin depends on
boolean | $recursive | enable required plugins automatically |
thrown when a dependency fails
None found |
checkDependants(boolean $recursive)
Disables all plugins which depend on this plugin
boolean | $recursive | disabled dependant plugins automatically |
thrown when a dependency fails
None found |
checkCompatibility()
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 if it can't provide compatibility in such cases. However, we still have to decide whether this plugin is compatible to newer API versions, what requires some special (version specific) precaution and is therefore usually not the case.
thrown when the plugin's and Pico's API aren't compatible
None found |