You are here

public function ReindexConfirm::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 64
Contains \Drupal\search\Form\ReindexConfirm.

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();
    }
    drupal_set_message($this
      ->t('All search indexes will be rebuilt.'));
    $form_state
      ->setRedirectUrl($this
      ->getCancelUrl());
  }
}