public static void
highlighter
(array $terms, mixed $start = 'highlighter-start', mixed $end = 'highlighter-end', mixed $className = 'highlight', mixed $tag = 'span')
/**
* Highlight some words via Javascript.
*
* @param array $terms Array of words that should be highlighted.
* @param string $start ID of the element that marks the begin of the section in which words
* should be highlighted. Note this element will be removed from the DOM.
* @param string $end ID of the element that end this section.
* Note this element will be removed from the DOM.
* @param string $className Class name of the element highlights are wrapped in.
* @param string $tag Tag that will be used to wrap the highlighted words.
*
* @return void
*
* @since 2.5
*
* @deprecated 5.0 Use the script directly
*/
public static function highlighter(array $terms, $start = 'highlighter-start', $end = 'highlighter-end', $className = 'highlight', $tag = 'span')
{
$terms = array_filter($terms, 'strlen');
if (!empty($terms)) {
$doc = Factory::getDocument();
$doc->getWebAssetManager()->useScript('highlight');
$doc->addScriptOptions('highlight', [['class' => 'js-highlight', 'highLight' => $terms, 'compatibility' => true, 'start' => $start, 'end' => $end]]);
}
}