You are here

protected function SuggestionAdminForm::setKeywords in Autocomplete Search Suggestions 8.2

Same name and namespace in other branches
  1. 8 src/Form/SuggestionAdminForm.php \Drupal\suggestion\Form\SuggestionAdminForm::setKeywords()
  2. 3.0.x src/Form/SuggestionAdminForm.php \Drupal\suggestion\Form\SuggestionAdminForm::setKeywords()

Process all the priority suggestions submitted.

Parameters

Drupal\Core\Form\FormStateInterface $form_state: A Drupal form state object.

1 call to SuggestionAdminForm::setKeywords()
SuggestionAdminForm::submitForm in src/Form/SuggestionAdminForm.php
Submit function for the suggestion configuration form.

File

src/Form/SuggestionAdminForm.php, line 313

Class

SuggestionAdminForm
Suggestion configuration form.

Namespace

Drupal\suggestion\Form

Code

protected function setKeywords(FormStateInterface $form_state) {
  $language_keywords = $form_state
    ->getValue('keywords');
  foreach ($language_keywords as $language => $group) {
    foreach (preg_split('/\\s*[\\n\\r]+\\s*/su', trim($group)) as $txt) {
      Helper::insert($txt, $language, Storage::PRIORITY_BIT);
    }
  }
}