protected function SearchTextProcessor::truncate in Drupal 9
Helper function for array_walk in ::analyze().
Parameters
string $text: The text to be truncated.
File
- core/
modules/ search/ src/ SearchTextProcessor.php, line 177
Class
- SearchTextProcessor
- Processes search text for indexing.
Namespace
Drupal\searchCode
protected function truncate(string &$text) : void {
if (is_numeric($text)) {
$text = ltrim($text, '0');
}
if (mb_strlen($text) <= 50) {
return;
}
$text = mb_substr($text, 0, 50);
}