1<?php
2
3require_once __DIR__.'/lightmenu.class.php';
4
5use dokuwiki\Extension\ActionPlugin;
6use dokuwiki\Extension\Event;
7use dokuwiki\Extension\EventHandler;
8
9class action_plugin_lightmenu extends ActionPlugin
10{
11	public function register(EventHandler $controller)
12	{
13		$controller->register_hook('COMMON_WIKIPAGE_SAVE', 'BEFORE', $this, 'lm_update');
14	}
15
16	// take care of updating lightmenu meta data and sidebar cache on wiki page save.
17	public function lm_update($event)
18	{
19		if ($event->data['contentChanged'])
20			lightmenu::update($event->data['id'],$event->data['newContent']);
21	}
22}
23