1<?php
2
3use dokuwiki\Extension\ActionPlugin;
4
5/**
6 * DokuWiki Plugin xlsx2dw (Action Component)
7 *
8 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
9 * @author  moevm <ydginster@gmail.com>
10 */
11class action_plugin_xlsx2dw extends ActionPlugin
12{
13
14    /** @inheritDoc */
15    public function register(Doku_Event_Handler $controller)
16    {
17        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
18    }
19
20    /**
21     * @param Doku_Event $event  event object by reference
22     * @param mixed      $param  optional parameter passed when event was registered
23     * @return void
24     */
25    public function insert_button(Doku_Event $event, $param) {
26        $config = require(DOKU_PLUGIN . 'xlsx2dw/conf/config.php');
27
28        $event->data[] = [
29            'type'   => $config['buttonType'],
30            'title'  => $config['buttonTitle'],
31            'icon'   => $config['buttonIcon'],
32            'block'  => $config['buttonBlock'],
33            'open'   => $config['buttonOpen'],
34            'close'  => $config['buttonClose'],
35            'id'     => $config['buttonID']
36        ];
37    }
38}
39