You are here

function pm_attribute_delete in Drupal PM (Project Management) 7

Defines attribute delete confirmation form.

1 string reference to 'pm_attribute_delete'
pm_menu in ./pm.module
Implements hook_menu().

File

./pm.admin.inc, line 429
List functions for the Project Management module.

Code

function pm_attribute_delete($form, $form_state, $aid) {
  $destination = drupal_get_destination();
  if (array_key_exists('destination', $_REQUEST)) {
    $destination = $_REQUEST['destination'];
    unset($_REQUEST['destination']);
    $form['destination'] = array(
      '#type' => 'value',
      '#value' => $destination,
    );
  }
  $form['aid'] = array(
    '#type' => 'value',
    '#value' => $aid,
  );
  $result = db_select('pmattribute', 'sa')
    ->fields('sa')
    ->condition('sa.aid', $aid)
    ->execute();
  $a = $result
    ->fetchObject();
  $title = $a->domain . ' : ' . $a->avalue;
  return confirm_form($form, t('Are you sure you want to delete the attribute %title?', array(
    '%title' => $title,
  )), array(
    'path' => 'pm/attributes/edit/' . $aid,
    'query' => $destination,
  ), t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}