diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-03 19:25:53 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-03 19:25:53 -0500 |
commit | 4c524700af72a01c4ffe9949a9005b41dc7e7e4d (patch) | |
tree | 1646877a23b9424258df88f867ef443f42c2119f /doc/plugin-events.markdown | |
parent | 913ec9e39ff6326d0d3e4bea92dc6d06b3d2d1bd (diff) |
Add doc for plugin events
Diffstat (limited to 'doc/plugin-events.markdown')
-rw-r--r-- | doc/plugin-events.markdown | 27 |
1 files changed, 27 insertions, 0 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. |