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.
 
 
 
 
 

41 lines
1.1 KiB

  1. <?php
  2. namespace dokuwiki\Menu\Item;
  3. /**
  4. * Class Discussion
  5. */
  6. class Discussion extends AbstractItem
  7. {
  8. /** @inheritdoc */
  9. public function __construct()
  10. {
  11. parent::__construct();
  12. if (!tpl_getConf('showDiscussion')) {
  13. throw new \RuntimeException("discussion is not available");
  14. }
  15. unset($this->params['do']);
  16. $discuss_page = str_replace('@ID@', $this->id, tpl_getConf('discussionPage'));
  17. $discuss_page_raw = str_replace('@ID@', '', tpl_getConf('discussionPage'));
  18. $is_discuss_page = strpos($this->id, $discuss_page_raw) !== false;
  19. $back_id = str_replace($discuss_page_raw, '', $this->id);
  20. if ($is_discuss_page) {
  21. $this->label = tpl_getLang('back_to_article');
  22. $this->id = cleanID($back_id);
  23. $this->svg = tpl_incdir() . 'images/menu/file-document-box-outline.svg';
  24. } else {
  25. $this->label = tpl_getLang('discussion');
  26. $this->id = cleanID($discuss_page);
  27. $this->svg = tpl_incdir() . 'images/menu/comment-text-multiple.svg';
  28. }
  29. }
  30. }