You are here

function biblio_form_types_delete in Bibliography Module 5

2 string references to 'biblio_form_types_delete'
biblio_form_types_delete_submit in ./biblio.module
biblio_menu in ./biblio.module
Implementation of hook_menu().

File

./biblio.module, line 930

Code

function biblio_form_types_delete() {
  $args = func_get_args();
  if ($args[0] > 0 && is_numeric($args[0])) {
    $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE t.tid = %d ', $args[0]);
    $row = db_fetch_array($result);
    $result = db_query('SELECT b.* FROM {biblio} as b WHERE b.biblio_type = %d', $row['tid']);
    if ($num_rows = db_num_rows($result)) {
      $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/types', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
    return $output;
  }
  else {
    drupal_goto('admin/settings/biblio/types');
  }
}