1<?php 2 3/** 4 * @license See LICENSE file 5 */ 6 7// See help: https://www.dokuwiki.org/devel:toolbar 8 9class action_plugin_bpmnio_toolbar extends DokuWiki_Action_Plugin 10{ 11 public function register(Doku_Event_Handler $controller) 12 { 13 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handleToolbar'); 14 } 15 16 public function handleToolbar(Doku_Event $event) 17 { 18 $basedir = DOKU_BASE . 'lib/plugins/bpmnio/images/toolbar/'; 19 $event->data[] = array( 20 'type' => 'picker', 21 'title' => $this->getLang('picker'), 22 'icon' => $basedir . 'picker.png', 23 'list' => array( 24 array( 25 'type' => 'format', 26 'class' => 'plugin-bpmnio icon-large', 27 'title' => $this->getLang('bpmn_add'), 28 'icon' => $basedir . 'bpmn_add.png', 29 'open' => $this->getFileContent('bpmn_open'), 30 'close' => $this->getFileContent('bpmn_close') 31 ), 32 array( 33 'type' => 'format', 34 'class' => 'plugin-bpmnio icon-large', 35 'title' => $this->getLang('dmn_add'), 36 'icon' => $basedir . 'dmn_add.png', 37 'open' => $this->getFileContent('dmn_open'), 38 'close' => $this->getFileContent('dmn_close') 39 ) 40 ), 41 ); 42 } 43 44 private function getFileContent($file) 45 { 46 return trim(file_get_contents(__DIR__ . '/../data/' . $file . '.text')); 47 } 48} 49