1<?php
2/**
3 * Comment Syntax plugin for DokuWiki; action component
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
7 */
8class action_plugin_commentsyntax extends DokuWiki_Action_Plugin
9{
10    /**
11     * Registers a callback function for a given event
12     */
13    public function register(Doku_Event_Handler $controller)
14    {
15        if ($this->getConf('toolbar_button')) {
16            $controller->register_hook(
17                'TOOLBAR_DEFINE', 'AFTER', $this, 'handleToolbar'
18            );
19        }
20    }
21
22    public function handleToolbar(Doku_Event $event)
23    {
24        $event->data[] = [
25            'type' => 'toggleCommentBlock',
26            'title' => $this->getLang('toolbar_title'),
27            'icon' => DOKU_REL.'lib/plugins/commentsyntax/images/comment.png',
28        ];
29    }
30}
31