function search_invoke_preprocess

Same name in other branches
  1. 7.x modules/search/search.module \search_invoke_preprocess()
  2. 8.9.x core/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

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);
    \Drupal::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.