bcfa79bdbb5e44b0270f432fd60e7b432a247534
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / search_preprocess.twig
1 /**
2  * Implements hook_search_preprocess().
3  */
4 function {{ machine_name }}_search_preprocess($text, $langcode = NULL) {
5   // If the language is not set, get it from the language manager.
6   if (!isset($langcode)) {
7     $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
8   }
9
10   // If the langcode is set to 'en' then add variations of the word "testing"
11   // which can also be found during English language searches.
12   if ($langcode == 'en') {
13     // Add the alternate verb forms for the word "testing".
14     if ($text == 'we are testing') {
15       $text .= ' test tested';
16     }
17   }
18
19   return $text;
20 }