public function ReindexConfirm::submitForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/search/src/Form/ReindexConfirm.php \Drupal\search\Form\ReindexConfirm::submitForm()
- 9 core/modules/search/src/Form/ReindexConfirm.php \Drupal\search\Form\ReindexConfirm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- core/
modules/ search/ src/ Form/ ReindexConfirm.php, line 61
Class
- ReindexConfirm
- Provides the search reindex confirmation form.
Namespace
Drupal\search\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form['confirm']) {
// Ask each active search page to mark itself for re-index.
$search_page_repository = \Drupal::service('search.search_page_repository');
foreach ($search_page_repository
->getIndexableSearchPages() as $entity) {
$entity
->getPlugin()
->markForReindex();
}
$this
->messenger()
->addStatus($this
->t('All search indexes will be rebuilt.'));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}