1<?php
2/**
3 * DokuWiki Plugin linkscollection (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Anna Dabrowska <dokuwiki@cosmocode.de>
7 */
8class action_plugin_linkscollection_button extends DokuWiki_Action_Plugin
9{
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 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' => 'mediapopup',
33            'title' => 'Links collection',
34            'icon' => '../../plugins/linkscollection/images/toolbar/link-variant-plus.png',
35            'block'  => false,
36            'url' => 'lib/plugins/linkscollection/exe/tree.php?idx=',
37            'name' => 'Link collection',
38            'options' => 'width=950,height=800,left=20,top=20,scrollbars=yes,resizable=yes',
39        ];
40    }
41}
42
43