View/Helper/HighlightTerms.php

Classes 
Classes
Kwf_View_Helper_HighlightTerms

\Kwf_View_Helper_HighlightTerms

Methods
highlightTerms

Methods

highlightTerms

highlightTerms( string|array $terms, string $text, array $options = array ) : string

Highlights a term in a text and shorts it. The output then may look like the description of a web-search-engine result.

Arguments
$terms
stringarray
The term(s) to highlight. Each must contain at least a char of: a-z A-Z 0-9
$text
string
The text to highlight the terms in.
$options
array
Options for the highlighting. Possible keys an their default values are: maxReturnLength => 350 // the maximum text-length to be returned. Set to '0' to return full string. maxReturnBlocks => 3 // maximum blocks to be returned blockSeparator => ' ... ' // string with which blocks are separated cutWithinWords => false // if the blocks are cut within words or only on a space
Output
string
$highlightenedText The highlightened and shortened text.
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox 0.12.3.