content[] = sprintf('', static::HTML_LIST_TAG); } public function beginChildren(): void { $this->content[] = sprintf('<%s class="%s">', static::HTML_LIST_TAG, static::CSS_CLASS); } public function endChildren(): void { $this->content[] = sprintf('', static::HTML_LIST_TAG); } public function render() { if ($this->getInnerIterator()->isEmpty()) { return '

' . mt('doc', 'Documentation is empty.') . '

'; } $view = $this->getView(); $zendUrlHelper = $view->getHelper('Url'); foreach ($this as $section) { $path = $zendUrlHelper->url( array_merge( $this->urlParams, array( 'chapter' => $this->encodeUrlParam($section->getChapter()->getId()) ) ), $this->url, false, false ); $url = $view->url($path); /** @var \Icinga\Web\Url $url */ if ($this->getDepth() > 0) { $url->setAnchor($this->encodeAnchor($section->getId())); } $urlAttributes = array( 'data-base-target' => '_next', 'title' => $section->getId() === $section->getChapter()->getId() ? sprintf( $view->translate('Show the chapter "%s"', 'toc.render.section.link'), $section->getChapter()->getTitle() ) : sprintf( $view->translate('Show the section "%s" of the chapter "%s"', 'toc.render.section.link'), $section->getTitle(), $section->getChapter()->getTitle() ) ); if ($section->getNoFollow()) { $urlAttributes['rel'] = 'nofollow'; } $this->content[] = '
  • ' . $this->getView()->qlink( $section->getTitle(), $url->getAbsoluteUrl(), null, $urlAttributes ); if (! $section->hasChildren()) { $this->content[] = '
  • '; } } return implode("\n", $this->content); } }