xref: /template/writr/tpl_functions.php (revision 9116ecf3dfcfbcdcf4b5c7858dc0a9b36972bfd1)
1<?php
2/**
3 * Template Functions
4 *
5 * This file provides template specific custom functions that are
6 * not provided by the DokuWiki core.
7 * It is common practice to start each function with an underscore
8 * to make sure it won't interfere with future core functions.
9 */
10
11// must be run from within DokuWiki
12if (!defined('DOKU_INC')) die();
13
14/**
15 * Create event for tools menues
16 *
17 * @author Anika Henke <anika@selfthinker.org>
18 */
19function _tpl_toolsevent($toolsname, $items, $view='main') {
20    $data = array(
21        'view'  => $view,
22        'items' => $items
23    );
24
25    $hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
26    $evt = new Doku_Event($hook, $data);
27    if($evt->advise_before()){
28        foreach($evt->data['items'] as $k => $html) echo $html;
29    }
30    $evt->advise_after();
31}
32