xref: /dokuwiki/inc/Menu/Item/Top.php (revision e44b94a4bd0679ff22e14add34b60590fe7077d3)
193b8c351SAndreas Gohr<?php
293b8c351SAndreas Gohr
393b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item;
493b8c351SAndreas Gohr
5368ce258SAndreas Gohr/**
6368ce258SAndreas Gohr * Class Top
7368ce258SAndreas Gohr *
8368ce258SAndreas Gohr * Scroll back to the top. Uses a hash as $id which is handled special in getLink().
9368ce258SAndreas Gohr * Not shown in mobile context
10368ce258SAndreas Gohr */
1133b91513SAndreas Gohrclass Top extends AbstractItem
1233b91513SAndreas Gohr{
134bb2fc4aSAndreas Gohr    /** @inheritdoc */
1433b91513SAndreas Gohr    public function __construct()
1533b91513SAndreas Gohr    {
164bb2fc4aSAndreas Gohr        parent::__construct();
174bb2fc4aSAndreas Gohr
18*e44b94a4SAndreas Gohr        $this->svg = DOKU_INC . 'lib/images/menu/10-top_arrow-up.svg';
194bb2fc4aSAndreas Gohr        $this->accesskey = 't';
2033b91513SAndreas Gohr        $this->params = ['do' => ''];
214bb2fc4aSAndreas Gohr        $this->id = '#dokuwiki__top';
224bb2fc4aSAndreas Gohr        $this->context = self::CTX_DESKTOP;
234bb2fc4aSAndreas Gohr    }
2493b8c351SAndreas Gohr
25b965a044SAndreas Gohr    /**
26b965a044SAndreas Gohr     * Convenience method to create a <button> element
27b965a044SAndreas Gohr     *
28b965a044SAndreas Gohr     * Uses html_topbtn()
29b965a044SAndreas Gohr     *
30b965a044SAndreas Gohr     * @return string
3133b91513SAndreas Gohr     * @todo this does currently not support the SVG icon
32b965a044SAndreas Gohr     */
3333b91513SAndreas Gohr    public function asHtmlButton()
3433b91513SAndreas Gohr    {
35b965a044SAndreas Gohr        return html_topbtn();
36b965a044SAndreas Gohr    }
3793b8c351SAndreas Gohr}
38