SearchPageListBuilder::submitForm

public SearchPageListBuilder::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 DraggableListBuilder::submitForm

File

core/modules/search/src/SearchPageListBuilder.php, line 326

Class

SearchPageListBuilder
Defines a class to build a listing of search page entities.

Namespace

Drupal\search

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  $search_settings = $this->config('search.settings');
  // If these settings change, the default index needs to be rebuilt.
  if (($search_settings->get('index.minimum_word_size') != $form_state->getValue('minimum_word_size')) || ($search_settings->get('index.overlap_cjk') != $form_state->getValue('overlap_cjk'))) {
    $search_settings->set('index.minimum_word_size', $form_state->getValue('minimum_word_size'));
    $search_settings->set('index.overlap_cjk', $form_state->getValue('overlap_cjk'));
    // Specifically mark items in the default index for reindexing, since
    // these settings are used in the search_index() function.
    drupal_set_message($this->t('The default search index will be rebuilt.'));
    search_mark_for_reindex();
  }

  $search_settings
  ->set('index.cron_limit', $form_state->getValue('cron_limit'))
    ->set('logging', $form_state->getValue('logging'))
    ->save();

  drupal_set_message($this->t('The configuration options have been saved.'));
}
doc_Drupal
2016-10-29 09:40:42
Comments
Leave a Comment

Please login to continue.