content[] = '';
}
/**
* {@inheritdoc}
*/
public function beginChildren()
{
if ($this->getInnerIterator()->getMatches()) {
$this->content[] = '
';
}
}
/**
* {@inheritdoc}
*/
public function endChildren()
{
if ($this->getInnerIterator()->getMatches()) {
$this->content[] = '
';
}
}
/**
* {@inheritdoc}
*/
public function render()
{
foreach ($this as $section) {
if (($matches = $this->getInnerIterator()->getMatches()) === null) {
continue;
}
$title = $this->getView()->escape($section->getTitle());
$contentMatches = array();
foreach ($matches as $match) {
if ($match->getMatchType() === DocSearchMatch::MATCH_HEADER) {
$title = $match->highlight();
} else {
$contentMatches[] = sprintf(
'%s
',
$match->highlight()
);
}
}
$path = $this->getView()->getHelper('Url')->url(
array_merge(
$this->getUrlParams(),
array(
'chapter' => $this->encodeUrlParam($section->getChapter()->getId())
)
),
$this->url,
false,
false
);
$url = $this->getView()->url(
$path,
array('highlight-search' => $this->getInnerIterator()->getSearch()->getInput())
);
/** @type \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
$this->content[] = sprintf(
'%s',
$section->getNoFollow() ? 'rel="nofollow" ' : '',
$url->getAbsoluteUrl(),
$title
);
if (! empty($contentMatches)) {
$this->content = array_merge($this->content, $contentMatches);
}
if (! $section->hasChildren()) {
$this->content[] = '';
}
}
return implode("\n", $this->content);
}
}