1<?php 2 3namespace dokuwiki\plugin\dw2pdf; 4 5use dokuwiki\Menu\Item\AbstractItem; 6 7/** 8 * Class MenuItem 9 * 10 * Implements the PDF export button for DokuWiki's menu system 11 * 12 * @package dokuwiki\plugin\dw2pdf 13 */ 14class MenuItem extends AbstractItem 15{ 16 /** @var string do action for this plugin */ 17 protected $type = 'export_pdf'; 18 19 /** @var string icon file */ 20 protected $svg = __DIR__ . '/file-pdf.svg'; 21 22 /** 23 * MenuItem constructor. 24 */ 25 public function __construct() 26 { 27 parent::__construct(); 28 global $REV, $DATE_AT; 29 30 if ($DATE_AT) { 31 $this->params['at'] = $DATE_AT; 32 } elseif ($REV) { 33 $this->params['rev'] = $REV; 34 } 35 } 36 37 /** 38 * Get label from plugin language file 39 * 40 * @return string 41 */ 42 public function getLabel() 43 { 44 $hlp = plugin_load('action', 'dw2pdf'); 45 return $hlp->getLang('export_pdf_button'); 46 } 47} 48