You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.1 KiB

  1. <?php
  2. namespace dokuwiki\Menu\Item;
  3. /**
  4. * Class Help
  5. */
  6. class Help extends AbstractItem
  7. {
  8. /** @inheritdoc */
  9. public function __construct()
  10. {
  11. parent::__construct();
  12. if (!in_array('help', explode(',', tpl_getConf('pageIcons')))) {
  13. throw new \RuntimeException("help is not available");
  14. }
  15. unset($this->params['do']);
  16. $help_id = page_findnearest('help', tpl_getConf('useACL'));
  17. if (!$help_id) {
  18. throw new \RuntimeException("help page not found");
  19. }
  20. $this->label = hsc(p_get_first_heading($help_id));
  21. $this->svg = tpl_incdir() . 'images/menu/help.svg';
  22. $this->id = '#';
  23. $this->help_id = $help_id;
  24. $this->help_link = wl($help_id, array('do' => 'export_xhtmlbody'));
  25. }
  26. public function getLinkAttributes($classprefix = 'menuitem ')
  27. {
  28. $attr = parent::getLinkAttributes($classprefix);
  29. $attr['data-toggle'] = 'modal';
  30. $attr['data-help-id'] = $this->help_id;
  31. $attr['data-target'] = '.modal.help';
  32. $attr['data-link'] = $this->help_link;
  33. return $attr;
  34. }
  35. }