aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/demo_plugin
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-10-14 13:22:58 +0200
committerArthurHoaro <arthur@hoa.ro>2016-10-14 13:22:58 +0200
commit7fde6de1212323418401c15efba06026c704ca87 (patch)
tree63b7efe598d1c563eee939fe9be3505afff1d873 /plugins/demo_plugin
parentf63632a6fb84594b8aeacb387a5cd17b4a841d2c (diff)
downloadShaarli-7fde6de1212323418401c15efba06026c704ca87.tar.gz
Shaarli-7fde6de1212323418401c15efba06026c704ca87.tar.zst
Shaarli-7fde6de1212323418401c15efba06026c704ca87.zip
New init function for plugins, supports errors reporting
All plugins can optionally add an init function named `pluginname_init()` which is called when the plugin is loaded. This function is aware of the config, and can return initialization errors, which are displayed in the header template. Note that the previous error system hack no longer work.
Diffstat (limited to 'plugins/demo_plugin')
-rw-r--r--plugins/demo_plugin/demo_plugin.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index 18834e53..7335c9d4 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -15,6 +15,23 @@
15 */ 15 */
16 16
17/** 17/**
18 * Initialization function.
19 * It will be called when the plugin is loaded.
20 * This function can be used to return a list of initialization errors.
21 *
22 * @param $conf ConfigManager instance.
23 *
24 * @return array List of errors (optional).
25 */
26function demo_plugin_init($conf)
27{
28 $conf->get('toto', 'nope');
29
30 $errors[] = 'This a demo init error.';
31 return $errors;
32}
33
34/**
18 * Hook render_header. 35 * Hook render_header.
19 * Executed on every page redering. 36 * Executed on every page redering.
20 * 37 *