-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.php
55 lines (51 loc) · 1.73 KB
/
action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;
use dokuwiki\plugin\fulldisplay\MenuItem;
/**
* DokuWiki Plugin fulldisplay (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
class action_plugin_fulldisplay extends ActionPlugin
{
/** @inheritDoc */
public function register(EventHandler $controller)
{
$controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'handleMenuItemsAssemblyEvent', null, 300);
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handleDokuwikiStartedEvent');
}
/**
* Event handler for MENU_ITEMS_ASSEMBLY
*
* @see https://www.dokuwiki.org/devel:events:MENU_ITEMS_ASSEMBLY
* @param Event $event Event object
* @param mixed $param optional parameter passed when event was registered
* @return void
*/
public function handleMenuItemsAssemblyEvent(Event $event, $param)
{
if ($event->data['view'] !== 'page') {
return;
}
array_splice($event->data['items'], -1, 0, [new MenuItem()]);
}
/**
* Event handler for DOKUWIKI_STARTED
*
* @see https://www.dokuwiki.org/devel:events:DOKUWIKI_STARTED
* @param Event $event Event object
* @param mixed $param optional parameter passed when event was registered
* @return void
*/
public function handleDokuwikiStartedEvent(Event $event, $param) {
global $JSINFO;
$JSINFO['fulldisplay'] = [
'pageSelector' => $this->getConf('pageSelector'),
'zoom' => $this->getConf('zoom'),
'refresh' => $this->getConf('refresh'),
];
}
}