From 010199e8f846f6c0b4f23336338bfda17ec04901 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 13 Aug 2016 18:41:01 -0400 Subject: Add the possibility to attach template hooks with a callback --- doc/plugin-hooks.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/plugin-hooks.markdown') 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. -- cgit v1.2.3