You are here

function search_invoke_preprocess in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/search.module \search_invoke_preprocess()
  2. 6 modules/search/search.module \search_invoke_preprocess()
  3. 7 modules/search/search.module \search_invoke_preprocess()

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.

Deprecated

in drupal:9.1.0 and is removed from drupal:10.0.0. Use a custom implementation of SearchTextProcessor instead.

See also

https://www.drupal.org/node/3078162

1 call to search_invoke_preprocess()
SearchDeprecationTest::testInvokePreprocess in core/modules/search/tests/src/Kernel/SearchDeprecationTest.php

File

core/modules/search/search.module, line 244
Enables site-wide keyword searching.

Code

function search_invoke_preprocess(&$text, $langcode = NULL) {
  @trigger_error('search_invoke_preprocess() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use a custom implementation of SearchTextProcessorInterface instead. See https://www.drupal.org/node/3078162', E_USER_DEPRECATED);
  foreach (\Drupal::moduleHandler()
    ->getImplementations('search_preprocess') as $module) {
    $text = \Drupal::moduleHandler()
      ->invoke($module, 'search_preprocess', [
      $text,
      $langcode,
    ]);
  }
}