You are here

function apachesolr_search_bias_form_submit in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.admin.inc \apachesolr_search_bias_form_submit()
  2. 7 apachesolr_search.admin.inc \apachesolr_search_bias_form_submit()
1 string reference to 'apachesolr_search_bias_form_submit'
apachesolr_search_bias_form in ./apachesolr_search.admin.inc

File

./apachesolr_search.admin.inc, line 750
Administrative settings for searching.

Code

function apachesolr_search_bias_form_submit(&$form, &$form_state) {

  // Exclude unnecessary elements.
  unset($form_state['values']['form_id']);
  unset($form_state['values']['form_build_id']);
  unset($form_state['values']['form_token']);
  unset($form_state['values']['reset']);
  unset($form_state['values']['op']);
  unset($form_state['values']['submit']);
  foreach ($form_state['values'] as $key => $value) {
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    }

    // There is no need to set default variable values.
    if (!isset($form[$key]['#default_value']) || $form[$key]['#default_value'] != $value) {
      switch ($key) {
        case 'apachesolr_search_sticky_boost':
        case 'apachesolr_search_promote_boost':
        case 'apachesolr_search_date_boost':
        case 'apachesolr_search_comment_boost':
        case 'apachesolr_search_changed_boost':
        case 'apachesolr_search_type_boosts':
        case 'field_bias':
          apachesolr_environment_variable_set($form['#env_id'], $key, $value);
      }
    }
  }
  drupal_set_message(t('The configuration options have been saved.'));
}