xref: /plugin/bpmnio/action/editor.php (revision c4f02a6e87d8a7e5a5592838ccca7b7221b9de2e)
1<?php
2/**
3 * @license    See LICENSE file
4 * @author     Jaap de Haan <jaap.dehaan@color-of-code.de>
5 */
6
7// See help:
8// * https://www.dokuwiki.org/devel:section_editor
9// * https://www.dokuwiki.org/devel:releases:refactor2021
10
11// must be run within Dokuwiki
12if (!defined('DOKU_INC')) die();
13
14class action_plugin_bpmnio_editor extends DokuWiki_Action_Plugin
15{
16    public function register(Doku_Event_Handler $controller)
17    {
18        $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'secedit_button');
19    }
20
21    function secedit_button(Doku_Event $event)
22    {
23        if ($this->_shall_ignore($event)) return;
24
25        $event->data['name'] = $this->getLang('edit_diagram');
26    }
27
28    private function _shall_ignore(Doku_Event $event)
29    {
30        if ($event->data['target'] !== 'plugin_bpmnio')
31            return true;
32        return false;
33    }
34}
35