xref: /dokuwiki/inc/Menu/Item/Top.php (revision 944e9ba7254387adb60f253b0d8796f2276096b1)
1<?php
2
3namespace dokuwiki\Menu\Item;
4
5use dokuwiki\File\StaticImage;
6
7/**
8 * Class Top
9 *
10 * Scroll back to the top. Uses a hash as $id which is handled special in getLink().
11 * Not shown in mobile context
12 */
13class Top extends AbstractItem
14{
15    /** @inheritdoc */
16    public function __construct()
17    {
18        parent::__construct();
19
20        $this->svg = StaticImage::path('menu/10-top_arrow-up.svg');
21        $this->accesskey = 't';
22        $this->params = ['do' => ''];
23        $this->id = '#dokuwiki__top';
24        $this->context = self::CTX_DESKTOP;
25    }
26
27    /**
28     * Convenience method to create a <button> element
29     *
30     * Uses html_topbtn()
31     *
32     * @return string
33     * @todo this does currently not support the SVG icon
34     */
35    public function asHtmlButton()
36    {
37        return html_topbtn();
38    }
39}
40