-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMenuitem.php
78 lines (59 loc) · 1.75 KB
/
Menuitem.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
namespace dokuwiki\plugin\stale;
use dokuwiki\Menu\Item\AbstractItem;
use helper_plugin_stale;
/**
* Class MenuItem
*
* Implements the stale button
* https://www.dokuwiki.org/devel:menus:example
*/
class StaleMenuItem extends AbstractItem
{
/**
* The first compile time, the javascript may not
* work, we send the user to the admin page
*
* Abstract item does not use the getter method
* we override then the variable
*
* @return array
*/
protected $params = array(
"do" => "admin",
"page" => helper_plugin_stale::PLUGIN_NAME
);
const MENU_HTML_ELEMENT_ID = 'plugin_' . helper_plugin_stale::PLUGIN_NAME;
public function getLinkAttributes($classprefix = 'menuitem ')
{
$linkAttributes = parent::getLinkAttributes($classprefix);
/**
* A class and not an id
* because a menu item can be found twice on
* a page (For instance if you want to display it in a layout at a
* breakpoint and at another in another breakpoint
*/
$linkAttributes['class'] = self::MENU_HTML_ELEMENT_ID;
return $linkAttributes;
}
public function getType()
{
return "admin";
}
public function getTitle()
{
$stale = plugin_load('helper', helper_plugin_stale::PLUGIN_NAME);
return $stale->getLang('menu');
}
public function getLabel()
{
$stale = plugin_load('helper', helper_plugin_stale::PLUGIN_NAME);
return $stale->getLang("menuItemLabel");
}
public function getSvg()
{
/** @var helper_plugin_stale $stale */
$stale = plugin_load('helper', helper_plugin_stale::PLUGIN_NAME);
return $stale->getIcon();
}
}