You are here

function weather_location_settings_form_submit in Weather 7

Same name and namespace in other branches
  1. 7.3 weather.forms.inc \weather_location_settings_form_submit()
  2. 7.2 weather.forms.inc \weather_location_settings_form_submit()

Implement hook_form_submit().

File

./weather.forms.inc, line 522
Provide forms for configuration of weather displays.

Code

function weather_location_settings_form_submit($form, &$form_state) {

  // Determine whether to insert or update a location.
  $location = (object) $form_state['values'];
  $location->icao = $location->place;
  if ($location->id == NULL) {
    drupal_write_record('weather_location', $location);
  }
  else {
    drupal_write_record('weather_location', $location, 'id');
  }
  if ($location->display_type == 'user') {
    $form_state['redirect'] = 'user/' . $location->display_number . '/weather';
  }
  else {
    $form_state['redirect'] = 'admin/config/user-interface/weather';
  }
}