forked from SoarinFerret/dokuwiki-plugin-pagebuttons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeletePageButton.php
58 lines (52 loc) · 1.5 KB
/
DeletePageButton.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
<?php
/**
* Delete Button plugin
*
* @copyright (c) 2020 Cody Ernesti
* @license GPLv2 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @author Cody Ernesti
*
* Modified from: https://github.com/dregad/dokuwiki-plugin-deletepagebutton
*
* Original license info:
*
* @copyright (c) 2020 Damien Regad
* @license GPLv2 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @author Damien Regad
*/
namespace dokuwiki\plugin\pagebuttons;
use dokuwiki\Menu\Item\AbstractItem;
/**
* Class DeletePageButton
*
* Implements the plugin's Delete button for DokuWiki's menu system
*
* @package dokuwiki\plugin\pagebuttons
*/
class DeletePageButton extends AbstractItem {
/** @var string icon file */
protected $svg = __DIR__ . '/images/trash-can-outline.svg';
/** @inheritdoc */
public function __construct() {
parent::__construct();
$this->params['sectok'] = getSecurityToken();
}
/**
* Get label from plugin language file
*
* @return string
*/
public function getLabel() {
$plugin = plugin_load('action', $this->type);
return "Delete Page";
//return $plugin->getLang('delete_menu_item');
}
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = parent::getLinkAttributes($classprefix);
if (empty($attr['class'])) {
$attr['class'] = '';
}
$attr['class'] .= ' plugin_pagebuttons_deletepage ';
return $attr;
}
}