You are here

public function SuggestionSearchForm::submitUpdateForm in Autocomplete Search Suggestions 8

Same name and namespace in other branches
  1. 8.2 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 163

Class

SuggestionSearchForm
Ngram search form.

Namespace

Drupal\suggestion\Form

Code

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