diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2015-08-01 02:23:07 +0200 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2015-08-01 02:23:07 +0200 |
commit | 84dd2b1a576208ba24c01a2df14bdbed57a8ece8 (patch) | |
tree | 13ab6b88d4e8402f53760657d6713ed3e5e71713 | |
parent | 66ff014ab579963895d7c103592a980c35b5845f (diff) | |
download | rpg-84dd2b1a576208ba24c01a2df14bdbed57a8ece8.tar.gz rpg-84dd2b1a576208ba24c01a2df14bdbed57a8ece8.tar.bz2 |
TEMPLATE_SITETOOLS_DISPLAY and TEMPLATE_USERTOOLS_DISPLAY
re-add PR #470 again.
-rw-r--r-- | inc/template.php | 22 | ||||
-rw-r--r-- | lib/tpl/dokuwiki/tpl_header.php | 18 |
2 files changed, 33 insertions, 7 deletions
diff --git a/inc/template.php b/inc/template.php index f918d1a04..70d93669d 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1982,5 +1982,27 @@ function tpl_classes() { return join(' ', $classes); } +/** + * Create event for tools menues + * + * @author Anika Henke <anika@selfthinker.org> + * @param string $toolsname name of menu + * @param array $items + * @param string $view e.g. 'main', 'detail', ... + */ +function tpl_toolsevent($toolsname, $items, $view = 'main') { + $data = array( + 'view' => $view, + 'items' => $items + ); + + $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY'; + $evt = new Doku_Event($hook, $data); + if($evt->advise_before()) { + foreach($evt->data['items'] as $k => $html) echo $html; + } + $evt->advise_after(); +} + //Setup VIM: ex: et ts=4 : diff --git a/lib/tpl/dokuwiki/tpl_header.php b/lib/tpl/dokuwiki/tpl_header.php index ee51cbd01..ab56f1ef8 100644 --- a/lib/tpl/dokuwiki/tpl_header.php +++ b/lib/tpl/dokuwiki/tpl_header.php @@ -46,10 +46,12 @@ if (!defined('DOKU_INC')) die(); tpl_userinfo(); /* 'Logged in as ...' */ echo '</li>'; } - tpl_action('admin', true, 'li'); - tpl_action('profile', true, 'li'); - tpl_action('register', true, 'li'); - tpl_action('login', true, 'li'); + tpl_toolsevent('usertools', array( + tpl_action('admin', true, 'li', true), + tpl_action('profile', true, 'li', true), + tpl_action('register', true, 'li', true), + tpl_action('login', true, 'li', true) + )); ?> </ul> </div> @@ -64,9 +66,11 @@ if (!defined('DOKU_INC')) die(); </div> <ul> <?php - tpl_action('recent', true, 'li'); - tpl_action('media', true, 'li'); - tpl_action('index', true, 'li'); + tpl_toolsevent('sitetools', array( + tpl_action('recent', true, 'li', true), + tpl_action('media', true, 'li', true), + tpl_action('bds', true, 'li', true) + )); ?> </ul> </div> |