public function SuggestionIndexForm::buildForm in Autocomplete Search Suggestions 8.2
Same name and namespace in other branches
- 8 src/Form/SuggestionIndexForm.php \Drupal\suggestion\Form\SuggestionIndexForm::buildForm()
- 3.0.x src/Form/SuggestionIndexForm.php \Drupal\suggestion\Form\SuggestionIndexForm::buildForm()
The suggestion 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::buildForm
File
- src/
Form/ SuggestionIndexForm.php, line 27
Class
- SuggestionIndexForm
- Suggestion indexing form.
Namespace
Drupal\suggestion\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$synced = Helper::getConfig('synced');
$form['feedback'] = [
'#markup' => '<div id="suggestion-index-feedback">' . ($synced ? $this
->t('No indexing required.') : $this
->t('Indexing required.')) . '</div>',
'#weight' => 10,
];
$form['flush'] = [
'#title' => $this
->t('Flush all suggestions'),
'#description' => $this
->t('Flushes all suggestions including priority and surfer suggestions.'),
'#type' => 'checkbox',
'#default_value' => FALSE,
'#required' => FALSE,
'#weight' => 20,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Index Suggestions'),
'#weight' => 30,
'#ajax' => [
'callback' => '\\Drupal\\suggestion\\Form\\SuggestionIndexForm::submitForm',
'effect' => 'fade',
'method' => 'replace',
'wrapper' => 'suggestion-index-feedback',
'progress' => [
'type' => 'throbber',
'message' => 'Please wait...',
],
],
];
return $form;
}