You are here

function apachesolr_environment_edit_submit in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr.admin.inc \apachesolr_environment_edit_submit()
  2. 7 apachesolr.admin.inc \apachesolr_environment_edit_submit()
1 string reference to 'apachesolr_environment_edit_submit'
apachesolr_environment_edit_form in ./apachesolr.admin.inc
Form builder for adding/editing a Solr environment used as a menu callback.

File

./apachesolr.admin.inc, line 261
Administrative pages for the Apache Solr framework.

Code

function apachesolr_environment_edit_submit($form, &$form_state) {
  apachesolr_environment_save($form_state['values']);
  if (!empty($form_state['values']['make_default'])) {
    apachesolr_set_default_environment($form_state['values']['env_id']);
  }
  cache_clear_all('apachesolr:environments', 'cache_apachesolr');
  drupal_set_message(t('The %name search environment has been saved.', array(
    '%name' => $form_state['values']['name'],
  )));

  // for some reason $_GET was not sufficient.
  if (isset($_REQUEST['destination'])) {
    unset($_REQUEST['destination']);
  }
  if (isset($form_state['clicked_button']['#redirect'])) {
    $form_state['redirect'] = array(
      $form_state['clicked_button']['#redirect'],
    );
  }
  else {
    $form_state['redirect'] = array(
      $_GET['q'],
    );
  }
}