1<?php 2/** 3 * Page Buttons plugin 4 * 5 * @copyright (c) 2020 Cody Ernesti 6 * @license GPLv2 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) 7 * @author Cody Ernesti 8 */ 9 10namespace dokuwiki\plugin\pagebuttons; 11use dokuwiki\Menu\Item\AbstractItem; 12 13/** 14 * Class NewPageButton 15 * 16 * Implements the plugin's new button for DokuWiki's menu system 17 * 18 * @package dokuwiki\plugin\pagebuttons 19 */ 20class NewPageButton extends AbstractItem { 21 22 /** @var string icon file */ 23 protected $svg = __DIR__ . '/images/file-plus-outline.svg'; 24 25 /** @inheritdoc */ 26 public function __construct($label) { 27 parent::__construct(); 28 $this->label = $label; 29 $this->params['sectok'] = getSecurityToken(); 30 } 31 32 /** 33 * Get label from plugin language file 34 * 35 * @return string 36 */ 37 public function getLabel() { 38 return $this->label; 39 } 40 41 public function getLinkAttributes($classprefix = 'menuitem ') { 42 $attr = parent::getLinkAttributes($classprefix); 43 if (empty($attr['class'])) { 44 $attr['class'] = ''; 45 } 46 $attr['class'] .= ' plugin_pagebuttons_newpage '; 47 return $attr; 48 } 49 50} 51