You are here

public function SuggestionIndexForm::submitForm in Autocomplete Search Suggestions 8.2

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

AJAX callback for the indexing form.

Parameters

array $form: A drupal form array.

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

Return value

array A Drupal form array.

Overrides FormInterface::submitForm

File

src/Form/SuggestionIndexForm.php, line 81

Class

SuggestionIndexForm
Suggestion indexing form.

Namespace

Drupal\suggestion\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $t = new TranslatableMarkup('Suggestions Indexed');
  if ($form_state
    ->getValue('flush')) {
    Storage::truncateSuggestion();
  }
  Helper::index();
  return [
    '#markup' => '<div id="suggestion-index-feedback"><p>' . $t
      ->render() . '</p></div>',
  ];
}