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.
 
 
 
 
 

43 lines
918 B

  1. <?php
  2. namespace dokuwiki\Menu\Item;
  3. /**
  4. * Class Permalink
  5. */
  6. class Permalink extends AbstractItem
  7. {
  8. /** @inheritdoc */
  9. public function __construct()
  10. {
  11. parent::__construct();
  12. if (!in_array('permalink', explode(',', tpl_getConf('pageIcons')))) {
  13. throw new \RuntimeException("permalink is not available");
  14. }
  15. unset($this->params['do']);
  16. $this->label = tpl_getLang('permalink');
  17. $this->svg = tpl_incdir() . 'images/menu/link.svg';
  18. $this->id = '#';
  19. }
  20. public function getLink()
  21. {
  22. global $ID;
  23. global $INFO;
  24. return DOKU_URL . DOKU_SCRIPT . '?id=' . $ID . '&rev=' . $INFO['lastmod'];
  25. }
  26. public function getLinkAttributes($classprefix = 'menuitem ')
  27. {
  28. $attr = parent::getLinkAttributes($classprefix);
  29. $attr['target'] = '_blank';
  30. return $attr;
  31. }
  32. }