From ac753695e9fc968f2fcfe44cab0bf6ba3888df0f Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 10 Dec 2013 21:26:42 +0100 Subject: [PATCH] If a namespace has a startpage, hide the page and link it on the namespace. refs T6 --- syntax.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/syntax.php b/syntax.php index 5f8ec80..851d4a3 100644 --- a/syntax.php +++ b/syntax.php @@ -106,18 +106,27 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin { $output = ''; foreach ($node->getNodes() as $node) { /** @var DokuWikiNode $node */ + if ($node->getName() == 'start') + continue; $title = (strlen($node->getMetaData('title')) > 0 ? $node->getMetaData('title') : $node->getName()); $access = auth_quickaclcheck($node->getFullID()); if ($node instanceof DokuWikiPage) { if ($access > 0) { - $output .= '
  • ' . $title . '
  • '; + $output .= '
  • ' . $title . '
  • ' . PHP_EOL; } } else if($node instanceof DokuWikiNameSpace) { /** @var DokuWikiNameSpace $node */ if ($this->depth <= $this->maxDepth) { if ($access > 0) { - $output .= '
  • ' . $title . '
  • '; + // lets check if the the namespace has a startpage and if yes link to it + if ($start = $node->hasChild('start')) { + $access = auth_quickaclcheck($start->getFullID()); + if ($access > 0) { + $title = '' . (strlen($node->getMetaData('title')) > 0 ? $node->getMetaData('title') : $node->getName()) . ''; + } + } + $output .= '
  • ' . $title . '
  • ' . PHP_EOL; } } }