You are here

function weather_location_delete_confirm in Weather 7

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

Generate a confirmation form before deleting.

1 string reference to 'weather_location_delete_confirm'
weather_menu in ./weather.module
Implement hook_menu().

File

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

Code

function weather_location_delete_confirm($form, &$form_state, $location_id) {
  $location = db_query('SELECT * FROM {weather_location} WHERE id=:id', array(
    ':id' => $location_id,
  ))
    ->fetchObject();
  $form['id'] = array(
    '#type' => 'value',
    '#value' => $location_id,
  );
  $form['display_type'] = array(
    '#type' => 'value',
    '#value' => $location->display_type,
  );
  $form['display_number'] = array(
    '#type' => 'value',
    '#value' => $location->display_number,
  );
  if ($location->display_type == 'user') {
    $return_path = 'user/' . $location->display_number . '/weather';
  }
  else {
    $return_path = 'admin/config/user-interface/weather';
  }
  return confirm_form($form, t('Are you sure you want to delete the location %name?', array(
    '%name' => $location->real_name,
  )), $return_path, NULL, t('Delete'));
}