You are here

function apachesolr_search_bias_form_submit in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 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 702
Administrative settings for searching.

Code

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

  // Exclude unnecessary elements.
  form_state_values_clean($form_state);
  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.'));
}