1<?php 2 3use dokuwiki\plugin\wordimport\MenuItem; 4use dokuwiki\Extension\ActionPlugin; 5use dokuwiki\Extension\EventHandler; 6use dokuwiki\Extension\Event; 7 8/** 9 * DokuWiki Plugin wordimport (Action Component) 10 * 11 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 12 * @author Andreas Gohr <dokuwiki@cosmocode.de> 13 */ 14class action_plugin_wordimport_menu extends ActionPlugin 15{ 16 /** @inheritDoc */ 17 public function register(EventHandler $controller) 18 { 19 $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'handleMenuAssembly'); 20 } 21 22 /** 23 * Event handler for MENU_ITEMS_ASSEMBLY 24 * 25 * @see https://www.dokuwiki.org/devel:events:MENU_ITEMS_ASSEMBLY 26 * @param Event $event Event object 27 * @param mixed $param optional parameter passed when event was registered 28 * @return void 29 */ 30 public function handleMenuAssembly(Event $event, $param) 31 { 32 if ($event->data['view'] != 'page') return; 33 array_splice($event->data['items'], -1, 0, [new MenuItem()]); 34 } 35} 36