*/ class AddSearchWordListViewHelper extends AbstractMeilisearchFrontendViewHelper { use CompileWithRenderStatic; /** * Initializes the arguments */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('url', 'string', 'The context searchResultSet', true); $this->registerArgument('searchWords', 'string', 'The document to highlight', true); $this->registerArgument('addNoCache', 'boolean', 'Should no_cache=1 be added or not', false, true); $this->registerArgument('keepCHash', 'boolean', 'Should cHash be kept or not', false, false); } /** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $url = $arguments['url']; /** @var $resultSet SearchResultSet */ $resultSet = self::getUsedSearchResultSetFromRenderingContext($renderingContext); if (!$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchResultsSiteHighlighting()) { return $url; } $searchWords = $arguments['searchWords']; $addNoCache = $arguments['addNoCache']; $keepCHash = $arguments['keepCHash']; /** @var $siteHighlighterUrlModifier SiteHighlighterUrlModifier */ $siteHighlighterUrlModifier = GeneralUtility::makeInstance(SiteHighlighterUrlModifier::class); return $siteHighlighterUrlModifier->modify($url, $searchWords, $addNoCache, $keepCHash); } }