You are here

function weather_display_delete_confirm_submit in Weather 7

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

Implement actual deletion of display.

1 string reference to 'weather_display_delete_confirm_submit'
weather_display_settings_form in ./weather.forms.inc
Create a settings form for a weather display.

File

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

Code

function weather_display_delete_confirm_submit($form, &$form_state) {

  // Delete associated locations.
  db_delete('weather_location')
    ->condition('display_type', $form_state['values']['type'])
    ->condition('display_number', $form_state['values']['number'])
    ->execute();

  // Delete actual display.
  db_delete('weather_display')
    ->condition('type', $form_state['values']['type'])
    ->condition('number', $form_state['values']['number'])
    ->execute();
  if ($form_state['values']['type'] == 'user') {
    $path = 'user/' . $form_state['values']['number'] . '/weather';
  }
  else {
    $path = 'admin/config/user-interface/weather';
  }
  $form_state['redirect'] = $path;
}