You are here

function weather_location_settings_form_submit in Weather 7.3

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

Implements hook_form_submit().

File

./weather.forms.inc, line 682
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->place_geoid = $location->place;
  if ($location->id == NULL) {
    drupal_write_record('weather_displays_places', $location);
  }
  else {
    drupal_write_record('weather_displays_places', $location, 'id');
  }
  if ($location->display_type == 'user') {
    $form_state['redirect'] = 'user/' . $location->display_number . '/weather';
  }
  else {
    $form_state['redirect'] = 'admin/config/user-interface/weather';
  }
}