summaryrefslogtreecommitdiff
path: root/doc/plugin-overrides.markdown
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-20 20:06:39 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-20 20:06:39 -0500
commitae708a712a5dd932c01e734f8450b899b1407a70 (patch)
tree348c01ad849fbeeee0fba74118b4536af4119333 /doc/plugin-overrides.markdown
parenta957195952e2c93177628ab07936d783da1388c3 (diff)
Offer the possibility to override internal formatter objects from plugins
Diffstat (limited to 'doc/plugin-overrides.markdown')
-rw-r--r--doc/plugin-overrides.markdown31
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/plugin-overrides.markdown b/doc/plugin-overrides.markdown
index 96a09e47..b9372bdf 100644
--- a/doc/plugin-overrides.markdown
+++ b/doc/plugin-overrides.markdown
@@ -40,3 +40,34 @@ You can still use the original template using the "kanboard:" prefix:
```php
<?= $this->render('kanboard:header') ?>
```
+
+Formatter Overrides
+-------------------
+
+Here an example to override formatter objects in Kanboard:
+
+```php
+class MyFormatter extends UserAutoCompleteFormatter {
+
+ public function format()
+ {
+ $users = parent::format();
+
+ foreach ($users as &$user) {
+ $user['label'] = 'something'; // Do something useful here
+ }
+
+ return $users;
+ }
+}
+
+class Plugin extends Base
+{
+ public function initialize()
+ {
+ $this->container['userAutoCompleteFormatter'] = $this->container->factory(function ($c) {
+ return new MyFormatter($c);
+ });
+ }
+}
+```