From 0371acff89b14b9bdcb03e72fd9637e26e6b517c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 29 Jan 2017 11:07:42 -0500 Subject: Move English documentation to folder en_US --- doc/en_US/plugin-events.markdown | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 doc/en_US/plugin-events.markdown (limited to 'doc/en_US/plugin-events.markdown') diff --git a/doc/en_US/plugin-events.markdown b/doc/en_US/plugin-events.markdown new file mode 100644 index 00000000..f4db8ff3 --- /dev/null +++ b/doc/en_US/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. -- cgit v1.2.3