Add the possibility to attach template hooks with local variables

This commit is contained in:
Frederic Guillot
2016-08-13 18:08:46 -04:00
parent ffe61abc69
commit 2ebe8b3272
4 changed files with 57 additions and 17 deletions

View File

@@ -153,6 +153,14 @@ Example to add new content in the dashboard sidebar:
$this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar');
```
Example to attach a template with local variables:
```php
$this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar', array(
'variable' => 'foobar',
));
```
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.