You are here

public function SuggestionSearchForm::submitUpdateForm in Autocomplete Search Suggestions 8.2

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

Ngram update submission function.

Parameters

array $form: A drupal form array.

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

File

src/Form/SuggestionSearchForm.php, line 185

Class

SuggestionSearchForm
Ngram search form.

Namespace

Drupal\suggestion\Form

Code

public function submitUpdateForm(array &$form, FormStateInterface $form_state) {
  $src = Helper::optionBits((array) $form_state
    ->getValue('src'));
  foreach ((array) $form_state
    ->getValue('list') as $ngram => $val) {
    if (!$val) {
      continue;
    }
    Helper::updateSrc($ngram, $src, $this->langMgr
      ->getCurrentLanguage()
      ->getId());
    $this
      ->messenger()
      ->addStatus($this
      ->t('Updated: “@ngram”', [
      '@ngram' => $ngram,
    ]));
  }
}