xref: /plugin/combo/action/toolbar.php (revision 007225e5fb2d3f64edaccd3bd447ca26effb9d68)
1<?php
2/**
3 * Action Component
4 * Add a button in the edit toolbar
5 *
6 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author     Nicolas GERARD
8 */
9
10use ComboStrap\PluginUtility;
11
12if (!defined('DOKU_INC')) die();
13require_once(__DIR__ . '/../class/PluginUtility.php');
14
15
16class action_plugin_combo_toolbar extends DokuWiki_Action_Plugin {
17
18    /**
19     * register the event handlers
20     *
21     * @author Nicolas GERARD
22     */
23    function register(Doku_Event_Handler $controller){
24        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ());
25    }
26
27    function handle_toolbar(&$event, $param) {
28        $unitShortcutKey = $this->getConf('UnitShortCutKey');
29
30        $event->data[] = array(
31            'type'   => 'format',
32            'title'  => $this->getLang('DocBlockButtonTitle').' ('.$this->getLang('AccessKey').': '.$unitShortcutKey.')',
33            'icon'   => '../../plugins/'. PluginUtility::PLUGIN_BASE_NAME .'/images/unit-doc-block.png',
34            'open'   => '<unit name="default">\n<file lang path>\n</file>\n\t<code lang>',
35            'close'  => '\n\t</code>\n\tt<console>\n\t</console></unit>\n',
36            'key'    => $unitShortcutKey
37        );
38
39
40    }
41
42}
43
44