1<?php 2/** 3 * Table editor 4 * 5 * @author Andreas Gohr <gohr@cosmocode.de> 6 */ 7 8use dokuwiki\Extension\Event; 9 10/** 11 * just intercepts ACTION_ACT_PREPROCESS and emits two new events 12 * 13 * We have two action components handling above event but need them to execute in a specific order. 14 * That's currently not possible to guarantee, so we catch the event only once and emit two of our own 15 * in the right order. Once DokuWiki supports a sort we can skip this. 16 */ 17class action_plugin_edittable_preprocess extends DokuWiki_Action_Plugin 18{ 19 /** 20 * Register its handlers with the DokuWiki's event controller 21 */ 22 public function register(Doku_Event_Handler $controller) 23 { 24 // register preprocessing for accepting editor data 25 $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_preprocess'); 26 } 27 28 /** 29 * See class description for WTF we're doing here 30 * 31 * @param Doku_Event $event 32 */ 33 public function handle_preprocess(Doku_Event $event) 34 { 35 Event::createAndTrigger('PLUGIN_EDITTABLE_PREPROCESS_EDITOR', $event->data); 36 Event::createAndTrigger('PLUGIN_EDITTABLE_PREPROCESS_NEWTABLE', $event->data); 37 } 38} 39