diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-08-13 18:41:01 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-08-13 18:41:01 -0400 |
commit | 010199e8f846f6c0b4f23336338bfda17ec04901 (patch) | |
tree | bce51661cd43034ed2d6bb6caf04574767a712ec /doc/plugin-hooks.markdown | |
parent | 2ebe8b32728c341ec16e1197fe2e12d32ddd5de5 (diff) |
Add the possibility to attach template hooks with a callback
Diffstat (limited to 'doc/plugin-hooks.markdown')
-rw-r--r-- | doc/plugin-hooks.markdown | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/plugin-hooks.markdown b/doc/plugin-hooks.markdown index a700e34b..97816d5f 100644 --- a/doc/plugin-hooks.markdown +++ b/doc/plugin-hooks.markdown @@ -161,6 +161,14 @@ $this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/ )); ``` +Example to attach a template with a callable: + +```php +$this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar', function($hook_param1, $hook_param2) { + return array('new_template_variable' => 'foobar'); // Inject a new variable into the plugin template +}); +``` + This call is usually defined in the `initialize()` method. The first argument is name of the hook and the second argument is the template name. |