Skip to content

Commit

Permalink
add TEMPLATE_SITETOOLS_DISPLAY and TEMPLATE_USERTOOLS_DISPLAY basing …
Browse files Browse the repository at this point in the history
…on Starter template
  • Loading branch information
Szymon Olewniczak committed Dec 10, 2013
1 parent 8c4759c commit 362a4f0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
19 changes: 19 additions & 0 deletions inc/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1786,5 +1786,24 @@ function tpl_classes() {
return join(' ', $classes);
}

/**
* Create event for tools menues
*
* @author Anika Henke <anika@selfthinker.org>
*/
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 :

19 changes: 12 additions & 7 deletions lib/tpl/dokuwiki/tpl_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@
tpl_userinfo(); /* 'Logged in as ...' */
echo '</li>';
}
tpl_action('admin', 1, 'li');
tpl_action('profile', 1, 'li');
tpl_action('register', 1, 'li');
tpl_action('login', 1, 'li');

tpl_toolsevent('usertools', array(
'admin' => tpl_action('admin', 1, 'li', 1),
'profile' => tpl_action('profile', 1, 'li', 1),
'register' => tpl_action('register', 1, 'li', 1),
'login' => tpl_action('login', 1, 'li', 1),
));
?>
</ul>
</div>
Expand All @@ -64,9 +67,11 @@
</div>
<ul>
<?php
tpl_action('recent', 1, 'li');
tpl_action('media', 1, 'li');
tpl_action('index', 1, 'li');
tpl_toolsevent('sitetools', array(
'recent' => tpl_action('recent', 1, 'li', 1),
'media' => tpl_action('media', 1, 'li', 1),
'index' => tpl_action('index', 1, 'li', 1),
));
?>
</ul>
</div>
Expand Down

0 comments on commit 362a4f0

Please sign in to comment.