You are here

public function SuggestionSearchForm::submitUpdateForm in Autocomplete Search Suggestions 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Form/SuggestionSearchForm.php \Drupal\suggestion\Form\SuggestionSearchForm::submitUpdateForm()
  2. 8 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 173

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
      ->messenger()
      ->addStatus($this
      ->t('Updated: “@ngram”', [
      '@ngram' => $ngram,
    ]));
  }
}