-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New init function for plugins, supports errors reporting #659
Conversation
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.
{ | ||
$riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
if (empty($riyUrl)) { | ||
$error = 'Readityourself plugin error: '. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to assign a variable, an error array can be returned directly:
if (empty($riyUrl)) {
return array('Error message');
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but when I'm dealing with a long string, I prefer to affect it before doing anything with it. I can change this if you think that's better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big deal, this could even come handy for more complex plugins that require checking several resources/config entries
{ | ||
$wallabagUrl = $conf->get('plugins.WALLABAG_URL'); | ||
if (empty($wallabagUrl)) { | ||
$error = 'Wallabag plugin error: '. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to assign a variable, an error array can be returned directly:
if (empty($wallabagUrl)) {
return array('Error message');
}
{ | ||
$riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
if (empty($riyUrl)) { | ||
$error = 'Readityourself plugin error: '. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big deal, this could even come handy for more complex plugins that require checking several resources/config entries
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.