summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/plugin-events.markdown27
-rw-r--r--doc/plugin-registration.markdown14
-rw-r--r--doc/plugins.markdown1
3 files changed, 28 insertions, 14 deletions
diff --git a/doc/plugin-events.markdown b/doc/plugin-events.markdown
new file mode 100644
index 00000000..f4db8ff3
--- /dev/null
+++ b/doc/plugin-events.markdown
@@ -0,0 +1,27 @@
+Using Events
+============
+
+Kanboard use internally the [Symfony EventDispatcher component](https://symfony.com/doc/2.3/components/event_dispatcher/index.html) to manage internal events.
+
+Event Listening
+---------------
+
+```php
+$this->on('app.bootstrap', function($container) {
+ // Do something
+});
+```
+
+- The first argument is the event name (string)
+- The second argument is a PHP callable function (closure or class method)
+
+Adding a new event
+------------------
+
+To add a new event, you have to call the method `register()` of the class `Kanboard\Core\Event\EventManager`:
+
+```php
+$this->eventManager->register('my.event.name', 'My new event description');
+```
+
+These events can be used by other components of Kanboard like automatic actions.
diff --git a/doc/plugin-registration.markdown b/doc/plugin-registration.markdown
index 37e71f9a..d15f98e1 100644
--- a/doc/plugin-registration.markdown
+++ b/doc/plugin-registration.markdown
@@ -124,17 +124,3 @@ $this->container['hourlyRate']->getAll();
```
Keys of the containers are unique across the application. If you override an existing class, you will change the default behavior.
-
-Event Listening
----------------
-
-Kanboard use internal events and your plugin can listen and perform actions on these events.
-
-```php
-$this->on('app.bootstrap', function($container) {
- // Do something
-});
-```
-
-- The first argument is the event name
-- The second argument is a PHP callable function (closure or class method)
diff --git a/doc/plugins.markdown b/doc/plugins.markdown
index 0b7316a9..791fe3bd 100644
--- a/doc/plugins.markdown
+++ b/doc/plugins.markdown
@@ -9,6 +9,7 @@ Plugin creators should specify explicitly the compatible versions of Kanboard. I
- [Creating your plugin](plugin-registration.markdown)
- [Using plugin hooks](plugin-hooks.markdown)
+- [Events](plugin-events.markdown)
- [Override default application behaviors](plugin-overrides.markdown)
- [Add schema migrations for plugins](plugin-schema-migrations.markdown)
- [Custom routes](plugin-routes.markdown)