function ReindexConfirm::submitForm

Same name in other branches
  1. 9 core/modules/search/src/Form/ReindexConfirm.php \Drupal\search\Form\ReindexConfirm::submitForm()
  2. 10 core/modules/search/src/Form/ReindexConfirm.php \Drupal\search\Form\ReindexConfirm::submitForm()
  3. 11.x core/modules/search/src/Form/ReindexConfirm.php \Drupal\search\Form\ReindexConfirm::submitForm()

Overrides FormInterface::submitForm

File

core/modules/search/src/Form/ReindexConfirm.php, line 61

Class

ReindexConfirm
Provides the search reindex confirmation form.

Namespace

Drupal\search\Form

Code

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());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.