xref: /plugin/dw2pdf/MenuItem.php (revision cae3b96541c7e5609ca9bbbab0e3c9db566c1eb6)
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        parent::__construct();
27        global $REV, $DATE_AT;
28
29        if($DATE_AT) {
30            $this->params['at'] = $DATE_AT;
31        } elseif($REV) {
32            $this->params['rev'] = $REV;
33        }
34    }
35
36    /**
37     * Get label from plugin language file
38     *
39     * @return string
40     */
41    public function getLabel() {
42        $hlp = plugin_load('action', 'dw2pdf');
43        return $hlp->getLang('export_pdf_button');
44    }
45}
46