You are here

function node_type_delete_confirm in Drupal 5

Same name and namespace in other branches
  1. 6 modules/node/content_types.inc \node_type_delete_confirm()
  2. 7 modules/node/content_types.inc \node_type_delete_confirm()

Menu callback; delete a single content type.

1 string reference to 'node_type_delete_confirm'
node_menu in modules/node/node.module
Implementation of hook_menu().

File

modules/node/content_types.inc, line 382
Content type editing UI.

Code

function node_type_delete_confirm($type) {
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type->type,
  );
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $type->name,
  );
  $message = t('Are you sure you want to delete the content type %type?', array(
    '%type' => $type->name,
  ));
  $caption = '';
  $num_nodes = db_num_rows(db_query("SELECT * FROM {node} WHERE type = '%s'", $type->type));
  if ($num_nodes) {
    $caption .= '<p>' . strtr(format_plural($num_nodes, '<strong>Warning:</strong> there is currently @count %type post on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.', '<strong>Warning:</strong> there are currently @count %type posts on your site. They may not be able to be displayed or edited correctly, once you have removed this content type.'), array(
      '%type' => theme('placeholder', $type->name),
    )) . '</p>';
  }
  $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
  return confirm_form($form, $message, 'admin/content/types', $caption, t('Delete'));
}