Skip to content

Commit

Permalink
Merge pull request #1278 from splitbrain/sitetools_usertools
Browse files Browse the repository at this point in the history
TEMPLATE_SITETOOLS_DISPLAY and TEMPLATE_USERTOOLS_DISPLAY
  • Loading branch information
selfthinker committed Aug 1, 2015
2 parents c4deb92 + 84dd2b1 commit b6171b3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
22 changes: 22 additions & 0 deletions inc/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 :

18 changes: 11 additions & 7 deletions lib/tpl/dokuwiki/tpl_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
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>
Expand All @@ -64,9 +66,11 @@
</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>
Expand Down

0 comments on commit b6171b3

Please sign in to comment.