function SearchTextProcessor::invokePreprocess

Same name in other branches
  1. 10 core/modules/search/src/SearchTextProcessor.php \Drupal\search\SearchTextProcessor::invokePreprocess()
  2. 11.x core/modules/search/src/SearchTextProcessor.php \Drupal\search\SearchTextProcessor::invokePreprocess()

Invokes hook_search_preprocess() to simplify text.

Parameters

string $text: Text to preprocess, passed by reference and altered in place.

string|null $langcode: Language code for the language of $text, if known.

1 call to SearchTextProcessor::invokePreprocess()
SearchTextProcessor::analyze in core/modules/search/src/SearchTextProcessor.php
Runs the text through character analyzers in preparation for indexing.

File

core/modules/search/src/SearchTextProcessor.php, line 119

Class

SearchTextProcessor
Processes search text for indexing.

Namespace

Drupal\search

Code

protected function invokePreprocess(string &$text, ?string $langcode = NULL) : void {
    $this->moduleHandler
        ->invokeAllWith('search_preprocess', function (callable $hook, string $module) use (&$text, &$langcode) {
        $text = $hook($text, $langcode);
    });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.