function search_admin_settings_submit

Form submission handler for search_admin_settings().

1 string reference to 'search_admin_settings_submit'
search_admin_settings in drupal/core/modules/search/search.admin.inc
Menu callback: displays the search module settings page.

File

drupal/core/modules/search/search.admin.inc, line 156
Admin page callbacks for the search module.

Code

function search_admin_settings_submit($form, &$form_state) {
  $config = config('search.settings');

  // If these settings change, the index needs to be rebuilt.
  if ($config
    ->get('index.minimum_word_size') != $form_state['values']['minimum_word_size'] || $config
    ->get('index.overlap_cjk') != $form_state['values']['overlap_cjk']) {
    $config
      ->set('index.minimum_word_size', $form_state['values']['minimum_word_size']);
    $config
      ->set('index.overlap_cjk', $form_state['values']['overlap_cjk']);
    drupal_set_message(t('The index will be rebuilt.'));
    search_reindex();
  }
  $config
    ->set('index.cron_limit', $form_state['values']['cron_limit']);
  $config
    ->set('default_module', $form_state['values']['default_module']);

  // Check whether we are resetting the values.
  if ($form_state['triggering_element']['#value'] == t('Reset to defaults')) {
    $new_modules = array(
      'node',
      'user',
    );
  }
  else {
    $new_modules = array_filter($form_state['values']['active_modules']);
  }
  if ($config
    ->get('active_modules') != $new_modules) {
    $config
      ->set('active_modules', $new_modules);
    drupal_set_message(t('The active search modules have been changed.'));
    state()
      ->set('menu_rebuild_needed', TRUE);
  }
  $config
    ->save();
}