protected function HtmlFilter::normalizeText in Search API 8
Removes superfluous whitespace and unescapes HTML entities.
Parameters
string $value: The text to process.
Return value
string The text without unnecessary whitespace and HTML entities transformed back to plain text.
3 calls to HtmlFilter::normalizeText()
- HtmlFilter::parseHtml in src/
Plugin/ search_api/ processor/ HtmlFilter.php - Tokenizes an HTML string according to the HTML elements.
- HtmlFilter::process in src/
Plugin/ search_api/ processor/ HtmlFilter.php - Processes a single string value.
- HtmlFilter::processFieldValue in src/
Plugin/ search_api/ processor/ HtmlFilter.php - Processes a single text element in a field.
File
- src/
Plugin/ search_api/ processor/ HtmlFilter.php, line 299
Class
- HtmlFilter
- Strips HTML tags from fulltext fields and decodes HTML entities.
Namespace
Drupal\search_api\Plugin\search_api\processorCode
protected function normalizeText($value) {
$value = Html::decodeEntities($value);
$value = trim($value);
$value = preg_replace('/\\s+/', ' ', $value);
return $value;
}