1<?php 2 3namespace dokuwiki\plugin\sectiontoggle; 4 5use dokuwiki\Menu\Item\AbstractItem; 6 7/** 8 * Class MenuItemSectionToggle 9 * 10 * Implements the 'menu section toggle' button for DokuWiki's menu system 11 * 12 * @package dokuwiki\plugin\folded 13 */ 14 15class MenuItemSectionToggle extends AbstractItem { 16 17 protected $svg = DOKU_INC . 'lib/plugins/sectiontoggle/menu-sectiontoggle.svg'; 18 19 public function __construct() { 20 parent::__construct(); 21 } 22 23 /** 24 * Get label from plugin language file 25 * 26 * @return string 27 */ 28 29 public function getLabel() { 30 $hlp = plugin_load('action', 'sectiontoggle'); 31 return $hlp->getLang('toggle_sections'); 32 } 33 34 35 /** 36 * Return this item's title 37 * 38 * @return string 39 */ 40 41 public function getTitle() { 42 return $this->getLabel(); 43 } 44 45 /** 46 * Return the link this item links to 47 * 48 * @return string 49 */ 50 51 public function getLink() { 52 return 'javascript:void(0);'; 53 } 54 55 /** 56 * Convenience method to get the attributes for constructing an <a> element 57 * 58 * @return array 59 */ 60 61 public function getLinkAttributes($classprefix = 'menuitem ') { 62 $attr = array( 63 'href' => $this->getLink(), 64 'title' => $this->getTitle(), 65 'id' => 'toggleAllBtn', 66 'rel' => 'nofollow', 67 'class' => 'section_toggle', 68 'onclick' => 'SectionToggle.updateSections();', 69 ); 70 return $attr; 71 } 72} 73