1<?php 2 3use dokuwiki\Extension\ActionPlugin; 4use dokuwiki\Extension\EventHandler; 5use dokuwiki\Extension\Event; 6 7/** 8 * DokuWiki Plugin structgantt (Action Component) 9 * 10 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 11 * @author Andreas Gohr <dokuwiki@cosmocode.de> 12 */ 13class action_plugin_structgantt extends ActionPlugin 14{ 15 /** 16 * Registers a callback function for a given event 17 * 18 * @param EventHandler $controller DokuWiki's event controller object 19 * @return void 20 */ 21 public function register(EventHandler $controller) 22 { 23 $controller->register_hook('PLUGIN_STRUCT_CONFIGPARSER_UNKNOWNKEY', 'BEFORE', $this, 'handleConfigparser'); 24 } 25 26 /** 27 * Add our own config keys 28 * 29 * @param Event $event event object by reference 30 * @param mixed $param [the parameters passed as fifth argument to register_hook() when this 31 * handler was registered] 32 */ 33 public function handleConfigparser(Event $event, $param) 34 { 35 if (!in_array($event->data['key'], ['skipweekend', 'skipweekends'])) return; 36 $event->preventDefault(); 37 $event->stopPropagation(); 38 $event->data['config']['skipweekends'] = (bool) $event->data['val']; 39 } 40} 41