register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'sectionEditButton'); $controller->register_hook('EDIT_FORM_ADDTEXTAREA', 'BEFORE', $this, 'handleForm'); $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handlePost'); $controller->register_hook('FORM_EDIT_OUTPUT', 'BEFORE', $this, 'handleFormEditOutput'); } public function handleFormEditOutput(Event $event) { /** @var Doku_Form $form */ $form = &$event->data; $previewButtonPosition = $form->findPositionByAttribute('id', 'edbtn__preview'); if ($previewButtonPosition !== false) { $form->removeElement($previewButtonPosition); } } public function sectionEditButton(Event $event) { if ($this->shallIgnore($event)) return; $event->data['name'] = $this->getLang('edit_diagram'); } public function handleForm(Event $event) { if ($this->shallIgnore($event)) return; global $TEXT; global $RANGE; global $INPUT; if (!$RANGE) { // section editing failed, use default editor instead $event->data['target'] = 'section'; return; } $event->stopPropagation(); $event->preventDefault(); /** @var Doku_Form $form */ $form = &$event->data['form']; $data = base64_encode($TEXT); $type = 'bpmn'; if ($event->data['target'] === 'plugin_bpmnio_dmn') $type = 'dmn'; $form->setHiddenField('plugin_bpmnio_data', $data); $form->addHTML(<<