xref: /dokuwiki/inc/Menu/Item/Top.php (revision 33b91513e25639a6c7eb35668484d29098f7c9b4)
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 */
11*33b91513SAndreas Gohrclass Top extends AbstractItem
12*33b91513SAndreas Gohr{
1393b8c351SAndreas Gohr
144bb2fc4aSAndreas Gohr    /** @inheritdoc */
15*33b91513SAndreas Gohr    public function __construct()
16*33b91513SAndreas Gohr    {
174bb2fc4aSAndreas Gohr        parent::__construct();
184bb2fc4aSAndreas Gohr
194bb2fc4aSAndreas Gohr        $this->svg = DOKU_INC . 'lib/images/menu/10-top_arrow-up.svg';
204bb2fc4aSAndreas Gohr        $this->accesskey = 't';
21*33b91513SAndreas Gohr        $this->params = ['do' => ''];
224bb2fc4aSAndreas Gohr        $this->id = '#dokuwiki__top';
234bb2fc4aSAndreas Gohr        $this->context = self::CTX_DESKTOP;
244bb2fc4aSAndreas Gohr    }
2593b8c351SAndreas Gohr
26b965a044SAndreas Gohr    /**
27b965a044SAndreas Gohr     * Convenience method to create a <button> element
28b965a044SAndreas Gohr     *
29b965a044SAndreas Gohr     * Uses html_topbtn()
30b965a044SAndreas Gohr     *
31b965a044SAndreas Gohr     * @return string
32*33b91513SAndreas Gohr     * @todo this does currently not support the SVG icon
33b965a044SAndreas Gohr     */
34*33b91513SAndreas Gohr    public function asHtmlButton()
35*33b91513SAndreas Gohr    {
36b965a044SAndreas Gohr        return html_topbtn();
37b965a044SAndreas Gohr    }
38b965a044SAndreas Gohr
3993b8c351SAndreas Gohr}
40