xref: /dokuwiki/inc/Menu/Item/Top.php (revision b965a044783079da3e1a393527e2f7b92eb15c2d)
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 */
1193b8c351SAndreas Gohrclass Top extends AbstractItem {
1293b8c351SAndreas Gohr
134bb2fc4aSAndreas Gohr    /** @inheritdoc */
144bb2fc4aSAndreas Gohr    public function __construct() {
154bb2fc4aSAndreas Gohr        parent::__construct();
164bb2fc4aSAndreas Gohr
174bb2fc4aSAndreas Gohr        $this->svg = DOKU_INC . 'lib/images/menu/10-top_arrow-up.svg';
184bb2fc4aSAndreas Gohr        $this->accesskey = 't';
194bb2fc4aSAndreas Gohr        $this->params = array('do' => '');
204bb2fc4aSAndreas Gohr        $this->id = '#dokuwiki__top';
214bb2fc4aSAndreas Gohr        $this->context = self::CTX_DESKTOP;
224bb2fc4aSAndreas Gohr    }
2393b8c351SAndreas Gohr
24*b965a044SAndreas Gohr    /**
25*b965a044SAndreas Gohr     * Convenience method to create a <button> element
26*b965a044SAndreas Gohr     *
27*b965a044SAndreas Gohr     * Uses html_topbtn()
28*b965a044SAndreas Gohr     *
29*b965a044SAndreas Gohr     * @todo this does currently not support the SVG icon
30*b965a044SAndreas Gohr     * @return string
31*b965a044SAndreas Gohr     */
32*b965a044SAndreas Gohr    public function asHtmlButton() {
33*b965a044SAndreas Gohr        return html_topbtn();
34*b965a044SAndreas Gohr    }
35*b965a044SAndreas Gohr
3693b8c351SAndreas Gohr}
37