ReindexConfirm::submitForm

public ReindexConfirm::submitForm(array &$form, FormStateInterface $form_state)

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 59

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());
  }
}
doc_Drupal
2016-10-29 09:37:20
Comments
Leave a Comment

Please login to continue.