function SearchPageListBuilder::submitForm

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

Overrides DraggableListBuilder::submitForm

File

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

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 SearchIndex::index() function.
        $this->messenger
            ->addStatus($this->t('The default search index will be rebuilt.'));
        $this->searchIndex
            ->markForReindex();
    }
    $search_settings->set('index.cron_limit', $form_state->getValue('cron_limit'))
        ->set('logging', $form_state->getValue('logging'))
        ->save();
    $this->messenger
        ->addStatus($this->t('The configuration options have been saved.'));
}

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