You are here

function biblio_admin_types_delete_form in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_types_delete_form()
  2. 7 includes/biblio.admin.inc \biblio_admin_types_delete_form()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_types_delete_form()
1 string reference to 'biblio_admin_types_delete_form'
biblio_menu in ./biblio.module
Implementation of hook_menu().

File

./biblio.admin.inc, line 1308

Code

function biblio_admin_types_delete_form() {
  $args = func_get_args();
  if ($args[1] > 0 && is_numeric($args[1])) {
    $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE t.tid = %d ', $args[1]);
    $row = db_fetch_array($result);
    $num_rows = db_result(db_query('SELECT COUNT(*) FROM {biblio} as b WHERE b.biblio_type = %d', $row['tid']));
    if ($num_rows) {
      $existing_msg = t('There are @count biblio entries of this type, you should change the type of these entries before proceeding otherwise they will be deleted', array(
        '@count' => $num_rows,
      ));
    }
    $form['tid'] = array(
      '#type' => 'value',
      '#value' => $row['tid'],
    );
    $output = confirm_form($form, t('Are you sure you want to delete the custom biblio type:  %title ? ', array(
      '%title' => $row['name'],
    )) . $existing_msg, $_GET['destination'] ? $_GET['destination'] : 'admin/settings/biblio/fields/type', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
    return $output;
  }
  else {
    drupal_goto('admin/settings/biblio/fields/type');
  }
}