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.
This commit is contained in:
parent
f63632a6fb
commit
7fde6de121
8 changed files with 115 additions and 15 deletions
plugins/demo_plugin
|
@ -14,6 +14,23 @@
|
|||
* and check user status with _LOGGEDIN_.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialization function.
|
||||
* It will be called when the plugin is loaded.
|
||||
* This function can be used to return a list of initialization errors.
|
||||
*
|
||||
* @param $conf ConfigManager instance.
|
||||
*
|
||||
* @return array List of errors (optional).
|
||||
*/
|
||||
function demo_plugin_init($conf)
|
||||
{
|
||||
$conf->get('toto', 'nope');
|
||||
|
||||
$errors[] = 'This a demo init error.';
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook render_header.
|
||||
* Executed on every page redering.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue