You are here

function yr_verdata_delete_confirm in Yr Weatherdata 6.2

Same name and namespace in other branches
  1. 7.3 yr_verdata.admin.inc \yr_verdata_delete_confirm()
  2. 7 yr_verdata.admin.inc \yr_verdata_delete_confirm()

Function for deleting locations from the database table.

Parameters

$yid: The unique id of the location.

Return value

Returns a confirmation form for deleting the given location.

1 string reference to 'yr_verdata_delete_confirm'
yr_verdata_menu in ./yr_verdata.module
Implementation of hook_menu()

File

./yr_verdata.admin.inc, line 334
This file contains the functions for the admin interface for yr_verdata.

Code

function yr_verdata_delete_confirm($form, $yid) {
  $location = yr_verdata_load_location($yid, TRUE);
  if ($location['status'] == TRUE) {
    $form = array();
    $form['yid'] = array(
      '#type' => 'hidden',
      '#value' => $yid,
    );
    $form['filename'] = array(
      '#type' => 'hidden',
      '#value' => $location['data']->filepath,
    );
    $question = t('Are you sure you want to remove the location %location, ID %yid from the database?', array(
      '%location' => $location['data']->name,
      '%yid' => $location['data']->yid,
    ));
    $description = t('The location and all related data will be removed from your site. You can re-add it later at !add.', array(
      '!add' => l('forecast/add', 'forecast/add'),
    ));
    $yes = t('Remove');
    return confirm_form($form, $question, 'forecast', $description, $yes);
  }
  else {
    $msg = t('No location found with the given ID.');
    drupal_set_message($msg, 'error');
    drupal_goto('forecast');
  }
}