summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-07 18:15:32 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-07 18:15:32 -0400
commit714bdb0d024c952cafd7924212b862ae31d7f1d4 (patch)
treeea92eeed3741db65d8117e0fb427763b94f1416d /doc
parent55ee906ba36cf66c3a390c98dde75e241de26e65 (diff)
Added method onStartup() for plugins
Diffstat (limited to 'doc')
-rw-r--r--doc/plugin-registration.markdown8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/plugin-registration.markdown b/doc/plugin-registration.markdown
index 03b3c841..4b6e85c0 100644
--- a/doc/plugin-registration.markdown
+++ b/doc/plugin-registration.markdown
@@ -70,6 +70,7 @@ Available methods from `Kanboard\Core\Plugin\Base`:
- `getPluginDescription()`: Should return plugin description
- `getPluginHomepage()`: Should return plugin Homepage (link)
- `setContentSecurityPolicy(array $rules)`: Override default HTTP CSP rules
+- `onStartup()`: If present, this method is executed automatically when the event "app.bootstrap" is triggered
Your plugin registration class can also inherit from Kanboard\Core\Base, that way you can access all classes and methods of Kanboard easily.
@@ -85,9 +86,10 @@ Plugin Translations
Plugin can be translated in the same way as the rest of the application. You must load the translations yourself when the session is created:
```php
-$this->on('app.bootstrap', function($container) {
- Translator::load($container['language']->getCurrentLanguage(), __DIR__.'/Locale');
-});
+public function onStartup()
+{
+ Translator::load($this->language->getCurrentLanguage(), __DIR__.'/Locale');
+}
```
The translations must be stored in the file `plugins/Myplugin/Locale/xx_XX/translations.php` (replace xx_XX by the language code fr_FR, en_US...).