summaryrefslogtreecommitdiff
path: root/doc/en_US/plugin-helpers.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'doc/en_US/plugin-helpers.markdown')
-rw-r--r--doc/en_US/plugin-helpers.markdown40
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/en_US/plugin-helpers.markdown b/doc/en_US/plugin-helpers.markdown
new file mode 100644
index 00000000..d65467f8
--- /dev/null
+++ b/doc/en_US/plugin-helpers.markdown
@@ -0,0 +1,40 @@
+Registering new helpers
+=======================
+
+Helper skeleton:
+
+```php
+<?php
+
+namespace Kanboard\Plugin\MyPlugin\Helper;
+
+use Kanboard\Core\Base;
+
+class MyHelper extends Base
+{
+ public function doSomething()
+ {
+ return 'foobar';
+ }
+}
+```
+
+Register your helper class:
+
+```php
+$this->helper->register('myHelper', '\Kanboard\Plugin\MyPlugin\Helper\MyHelper');
+```
+
+Using your helper from a template:
+
+```php
+<p>
+ <?= $this->myHelper->doSomething() ?>
+</p>
+```
+
+Using your helper from another class:
+
+```php
+$this->helper->myHelper->doSomething();
+```