Pico 3.0 API Documentation (master branch)

DummyPlugin extends AbstractPicoPlugin
in package

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.

Tags
author

Daniel Rudolf

link
https://picocms.org
license

https://opensource.org/licenses/MIT The MIT License

version
3.0

Table of Contents

API_VERSION  = 4
API version used by this plugin
on404ContentLoaded()  : mixed
Triggered after Pico has read the contents of the 404 file
on404ContentLoading()  : mixed
Triggered before Pico reads the contents of a 404 file
onConfigLoaded()  : mixed
Triggered after Pico has read its configuration
onContentLoaded()  : mixed
Triggered after Pico has read the contents of the file to serve
onContentLoading()  : mixed
Triggered before Pico reads the contents of the file to serve
onContentParsed()  : mixed
Triggered after Pico has parsed the contents of the file to serve
onContentParsing()  : mixed
Triggered before Pico parses the pages content
onContentPrepared()  : mixed
Triggered after Pico has prepared the raw file contents for parsing
onCurrentPageDiscovered()  : mixed
Triggered when Pico discovered the current, previous and next pages
onMetaHeaders()  : mixed
Triggered when Pico reads its known meta header fields
onMetaParsed()  : mixed
Triggered after Pico has parsed the meta header
onMetaParsing()  : mixed
Triggered before Pico parses the meta header
onPageRendered()  : mixed
Triggered after Pico has rendered the page
onPageRendering()  : mixed
Triggered before Pico renders the page
onPagesDiscovered()  : mixed
Triggered after Pico has discovered all known pages
onPagesLoaded()  : mixed
Triggered after Pico has sorted the pages array
onPagesLoading()  : mixed
Triggered before Pico reads all known pages
onPageTreeBuilt()  : mixed
Triggered after Pico built the page tree
onParsedownRegistered()  : mixed
Triggered when Pico registers the Parsedown parser
onPluginManuallyLoaded()  : mixed
Triggered when Pico manually loads a plugin
onPluginsLoaded()  : mixed
Triggered after Pico has loaded all available plugins
onRequestFile()  : mixed
Triggered after Pico has discovered the content file to serve
onRequestUrl()  : mixed
Triggered after Pico has evaluated the request URL
onSinglePageContent()  : mixed
Triggered when Pico loads the raw contents of a single page
onSinglePageLoaded()  : mixed
Triggered when Pico loads a single page
onSinglePageLoading()  : mixed
Triggered before Pico loads a single page
onThemeLoaded()  : mixed
Triggered after Pico loaded its theme
onThemeLoading()  : mixed
Triggered before Pico loads its theme
onTwigRegistered()  : mixed
Triggered when Pico registers the twig template engine
onYamlParserRegistered()  : mixed
Triggered when Pico registers the YAML parser

Constants

API_VERSION

API version used by this plugin

public int API_VERSION = 4

Methods

onCurrentPageDiscovered()

Triggered when Pico discovered the current, previous and next pages

public onCurrentPageDiscovered([array<string|int, mixed>|null &$currentPage = null ][, array<string|int, mixed>|null &$previousPage = null ][, array<string|int, mixed>|null &$nextPage = null ]) : mixed

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.

Parameters
$currentPage : array<string|int, mixed>|null = null

data of the page being served

$previousPage : array<string|int, mixed>|null = null

data of the previous page

$nextPage : array<string|int, mixed>|null = null

data of the next page

Tags
see
Pico::getCurrentPage()
see
Pico::getPreviousPage()
see
Pico::getNextPage()
Return values
mixed

onMetaHeaders()

Triggered when Pico reads its known meta header fields

public onMetaHeaders(array<string|int, string> &$headers) : mixed
Parameters
$headers : array<string|int, string>

list of known meta header fields; the array key specifies the YAML key to search for, the array value is later used to access the found value

Tags
see
Pico::getMetaHeaders()
Return values
mixed

onPageRendered()

Triggered after Pico has rendered the page

public onPageRendered(string &$output) : mixed
Parameters
$output : string

contents which will be sent to the user

Tags
see
DummyPlugin::onPageRendering()
Return values
mixed

onPageRendering()

Triggered before Pico renders the page

public onPageRendering(string &$templateName, array<string|int, mixed> &$twigVariables) : mixed
Parameters
$templateName : string

file name of the template

$twigVariables : array<string|int, mixed>

template variables

Tags
see
DummyPlugin::onPageRendered()
Return values
mixed

onPagesDiscovered()

Triggered after Pico has discovered all known pages

public onPagesDiscovered(array<string|int, array<string|int, mixed>> &$pages) : mixed

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.

Parameters
$pages : array<string|int, array<string|int, mixed>>

list of all known pages

Tags
see
DummyPlugin::onPagesLoading()
see
DummyPlugin::onPagesLoaded()
Return values
mixed

onPagesLoaded()

Triggered after Pico has sorted the pages array

public onPagesLoaded(array<string|int, array<string|int, mixed>> &$pages) : mixed

Please refer to Pico::readPages() for information about the structure of Pico's pages array and the structure of a single page's data.

Parameters
$pages : array<string|int, array<string|int, mixed>>

sorted list of all known pages

Tags
see
DummyPlugin::onPagesLoading()
see
DummyPlugin::onPagesDiscovered()
see
Pico::getPages()
Return values
mixed

onPageTreeBuilt()

Triggered after Pico built the page tree

public onPageTreeBuilt(array<string|int, mixed> &$pageTree) : mixed

Please refer to Pico::buildPageTree() for information about the structure of Pico's page tree array.

Parameters
$pageTree : array<string|int, mixed>

page tree

Tags
see
Pico::getPageTree()
Return values
mixed

onParsedownRegistered()

Triggered when Pico registers the Parsedown parser

public onParsedownRegistered(Parsedown &$parsedown) : mixed
Parameters
$parsedown : Parsedown

Parsedown instance

Tags
see
Pico::getParsedown()
Return values
mixed

onPluginsLoaded()

Triggered after Pico has loaded all available plugins

public onPluginsLoaded(array<string|int, object> $plugins) : mixed

This event is triggered nevertheless the plugin is enabled or not. It is NOT guaranteed that plugin dependencies are fulfilled!

Parameters
$plugins : array<string|int, object>

loaded plugin instances

Tags
see
Pico::loadPlugin()
see
Pico::getPlugin()
see
Pico::getPlugins()
Return values
mixed

onRequestUrl()

Triggered after Pico has evaluated the request URL

public onRequestUrl(string &$url) : mixed
Parameters
$url : string

part of the URL describing the requested contents

Tags
see
Pico::getRequestUrl()
Return values
mixed

onSinglePageContent()

Triggered when Pico loads the raw contents of a single page

public onSinglePageContent(string $id, string &$rawContent) : mixed

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.

Parameters
$id : string

relative path to the content file

$rawContent : string

raw file contents

Tags
see
DummyPlugin::onSinglePageLoading()
see
DummyPlugin::onSinglePageLoaded()
Return values
mixed

onSinglePageLoaded()

Triggered when Pico loads a single page

public onSinglePageLoaded(array<string|int, mixed> &$pageData) : mixed

Please refer to Pico::readPages() for information about the structure of a single page's data.

Parameters
$pageData : array<string|int, mixed>

data of the loaded page

Tags
see
DummyPlugin::onSinglePageLoading()
see
DummyPlugin::onSinglePageContent()
Return values
mixed

onSinglePageLoading()

Triggered before Pico loads a single page

public onSinglePageLoading(string $id, bool|null &$skipPage) : mixed

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...

Parameters
$id : string

relative path to the content file

$skipPage : bool|null

set this to TRUE to remove this page from the pages array, otherwise leave it unchanged

Tags
see
DummyPlugin::onSinglePageContent()
see
DummyPlugin::onSinglePageLoaded()
Return values
mixed

onThemeLoaded()

Triggered after Pico loaded its theme

public onThemeLoaded(string $theme, int $themeApiVersion, array<string|int, mixed> &$themeConfig) : mixed
Parameters
$theme : string

name of current theme

$themeApiVersion : int

API version of the theme

$themeConfig : array<string|int, mixed>

config array of the theme

Tags
see
DummyPlugin::onThemeLoading()
see
Pico::getTheme()
see
Pico::getThemeApiVersion()
Return values
mixed

onThemeLoading()

Triggered before Pico loads its theme

public onThemeLoading(string &$theme) : mixed
Parameters
$theme : string

name of current theme

Tags
see
Pico::loadTheme()
see
DummyPlugin::onThemeLoaded()
Return values
mixed

onTwigRegistered()

Triggered when Pico registers the twig template engine

public onTwigRegistered(TwigEnvironment &$twig) : mixed
Parameters
$twig : TwigEnvironment

Twig instance

Tags
see
Pico::getTwig()
Return values
mixed

onYamlParserRegistered()

Triggered when Pico registers the YAML parser

public onYamlParserRegistered(Parser &$yamlParser) : mixed
Parameters
$yamlParser : Parser

YAML parser instance

Tags
see
Pico::getYamlParser()
Return values
mixed

Search results