function node_type_delete_confirm

7.x content_types.inc node_type_delete_confirm($form, &$form_state, $type)
6.x content_types.inc node_type_delete_confirm(&$form_state, $type)

Menu callback; delete a single content type.

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

File

drupal-6.x/modules/node/content_types.inc, line 378
Content type editing UI.

Code

function node_type_delete_confirm(&$form_state, $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_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = '%s'", $type->type));
  if ($num_nodes) {
    $caption .= '<p>' . format_plural($num_nodes, '<strong>Warning:</strong> there is currently 1 %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' => $type->name)) . '</p>';
  }

  $caption .= '<p>' . t('This action cannot be undone.') . '</p>';

  return confirm_form($form, $message, 'admin/content/types', $caption, t('Delete'));
}