You are here

public function SuggestionIndexForm::submitForm in Autocomplete Search Suggestions 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Form/SuggestionIndexForm.php \Drupal\suggestion\Form\SuggestionIndexForm::submitForm()
  2. 8 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')) {
    SuggestionStorage::truncateSuggestion();
  }
  SuggestionHelper::index();
  return [
    '#markup' => '<div id="suggestion-index-feedback"><p>' . $t
      ->render() . '</p></div>',
  ];
}