forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
21 lines
620 B
Twig
21 lines
620 B
Twig
/**
|
|
* Implements hook_search_preprocess().
|
|
*/
|
|
function {{ machine_name }}_search_preprocess($text, $langcode = NULL) {
|
|
// If the language is not set, get it from the language manager.
|
|
if (!isset($langcode)) {
|
|
$langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
|
}
|
|
|
|
// If the langcode is set to 'en' then add variations of the word "testing"
|
|
// which can also be found during English language searches.
|
|
if ($langcode == 'en') {
|
|
// Add the alternate verb forms for the word "testing".
|
|
if ($text == 'we are testing') {
|
|
$text .= ' test tested';
|
|
}
|
|
}
|
|
|
|
return $text;
|
|
}
|