filter(array('ID' => $arguments['id']))->First(); if ($document && !$document->isHidden()) { if (!empty($content)) { $linkText = sprintf('%s', $document->Link(), $parser->parse($content)); } else { $linkText = $document->Link(); } } } if (empty($linkText)) { $errorPage = ErrorPage::get()->filter(array('ErrorCode' => '404'))->First(); if ($errorPage) { $linkText = $errorPage->Link(); } } return $linkText; } }