1<?php
2/**
3 * DokuWiki Plugin entitiesbutton (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Anna Dabrowska <dokuwiki@cosmocode.de>
7 */
8
9class action_plugin_entitiesbutton_button extends DokuWiki_Action_Plugin
10{
11    /**
12     * Registers a callback function for a given event
13     *
14     * @param Doku_Event_Handler $controller DokuWiki's event controller object
15     *
16     * @return void
17     */
18    public function register(Doku_Event_Handler $controller)
19    {
20        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'addEditorButton');
21    }
22
23    /**
24     * Add entities button to editor toolbar
25     *
26     * @param Doku_Event $event  event object by reference
27     * @return void
28     */
29    public function addEditorButton(Doku_Event $event)
30    {
31        $event->data[] = [
32            'type' => 'picker',
33            'title' => 'hello',
34            'icon' => '../../plugins/entitiesbutton/images/toolbar/entities.png',
35            'block'  => false,
36            'list' => array_keys(getEntities()),
37        ];
38    }
39}
40
41