Form submission handler for search_admin_settings().
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();
}