use core tpl_toolsevent (if available)

This commit is contained in:
Anika Henke 2015-08-01 18:35:11 +01:00
parent 61d6ac6246
commit 5c7e8b9af5
2 changed files with 16 additions and 16 deletions

View file

@ -73,7 +73,7 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
<?php /* the optional second parameter of tpl_action() switches between a link and a button, <?php /* the optional second parameter of tpl_action() switches between a link and a button,
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */ e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
?> ?>
<?php _tpl_toolsevent('usertools', array( <?php tpl_toolsevent('usertools', array(
'admin' => tpl_action('admin', 1, 'li', 1), 'admin' => tpl_action('admin', 1, 'li', 1),
'userpage' => _tpl_action('userpage', 1, 'li', 1), 'userpage' => _tpl_action('userpage', 1, 'li', 1),
'profile' => tpl_action('profile', 1, 'li', 1), 'profile' => tpl_action('profile', 1, 'li', 1),
@ -89,7 +89,7 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
<h3 class="a11y"><?php echo $lang['site_tools'] ?></h3> <h3 class="a11y"><?php echo $lang['site_tools'] ?></h3>
<?php tpl_searchform() ?> <?php tpl_searchform() ?>
<ul> <ul>
<?php _tpl_toolsevent('sitetools', array( <?php tpl_toolsevent('sitetools', array(
'recent' => tpl_action('recent', 1, 'li', 1), 'recent' => tpl_action('recent', 1, 'li', 1),
'media' => tpl_action('media', 1, 'li', 1), 'media' => tpl_action('media', 1, 'li', 1),
'index' => tpl_action('index', 1, 'li', 1), 'index' => tpl_action('index', 1, 'li', 1),
@ -149,7 +149,7 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
<div id="dokuwiki__pagetools"> <div id="dokuwiki__pagetools">
<h3 class="a11y"><?php echo $lang['page_tools'] ?></h3> <h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
<ul> <ul>
<?php _tpl_toolsevent('pagetools', array( <?php tpl_toolsevent('pagetools', array(
'edit' => tpl_action('edit', 1, 'li', 1), 'edit' => tpl_action('edit', 1, 'li', 1),
'discussion'=> _tpl_action('discussion', 1, 'li', 1), 'discussion'=> _tpl_action('discussion', 1, 'li', 1),
'revisions' => tpl_action('revisions', 1, 'li', 1), 'revisions' => tpl_action('revisions', 1, 'li', 1),

View file

@ -83,22 +83,22 @@ function _tpl_action($type, $link=0, $wrapper=0) {
} }
/** /**
* Create event for tools menues * copied to core (available since Detritus)
*
* @author Anika Henke <anika@selfthinker.org>
*/ */
function _tpl_toolsevent($toolsname, $items, $view='main') { if (!function_exists('tpl_toolsevent')) {
$data = array( function tpl_toolsevent($toolsname, $items, $view='main') {
'view' => $view, $data = array(
'items' => $items 'view' => $view,
); 'items' => $items
);
$hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY'; $hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
$evt = new Doku_Event($hook, $data); $evt = new Doku_Event($hook, $data);
if($evt->advise_before()){ if($evt->advise_before()){
foreach($evt->data['items'] as $k => $html) echo $html; foreach($evt->data['items'] as $k => $html) echo $html;
}
$evt->advise_after();
} }
$evt->advise_after();
} }
/** /**