summaryrefslogtreecommitdiff
path: root/doc/en_US/plugin-overrides.markdown
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-29 11:07:42 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-29 11:07:42 -0500
commit0371acff89b14b9bdcb03e72fd9637e26e6b517c (patch)
treef5878c9c07705379d137843cb8f92e3cdf7c20a8 /doc/en_US/plugin-overrides.markdown
parent3bf4789be255650b64f42231f41383cb13b65572 (diff)
Move English documentation to folder en_US
Diffstat (limited to 'doc/en_US/plugin-overrides.markdown')
-rw-r--r--doc/en_US/plugin-overrides.markdown73
1 files changed, 73 insertions, 0 deletions
diff --git a/doc/en_US/plugin-overrides.markdown b/doc/en_US/plugin-overrides.markdown
new file mode 100644
index 00000000..3b94bd60
--- /dev/null
+++ b/doc/en_US/plugin-overrides.markdown
@@ -0,0 +1,73 @@
+Plugin Overrides
+================
+
+Override HTTP Content Security Policy
+-------------------------------------
+
+If you would like to replace the default HTTP Content Security Policy header, you can use the method `setContentSecurityPolicy()`:
+
+```php
+<?php
+
+namespace Kanboard\Plugin\Csp;
+
+use Kanboard\Core\Plugin\Base;
+
+class Plugin extends Base
+{
+ public function initialize()
+ {
+ $this->setContentSecurityPolicy(array('script-src' => 'something'));
+ }
+}
+```
+
+Template Overrides
+------------------
+
+Any templates defined in the core can be overridden. For example, you can redefine the default layout or change email notifications.
+
+Example of template override:
+
+```php
+$this->template->setTemplateOverride('header', 'theme:layout/header');
+```
+
+The first argument is the original template name and the second argument the template to use as replacement.
+
+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);
+ });
+ }
+}
+```