You are here

function content_type_delete in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 includes/content.crud.inc \content_type_delete()
  2. 6 includes/content.crud.inc \content_type_delete()
  3. 6.2 includes/content.crud.inc \content_type_delete()

Make changes needed when a content type is deleted.

Parameters

$info: value supplied by hook_node_type()

1 call to content_type_delete()
content_node_type in ./content.module
Implementation of hook_node_type() React to change in node types

File

./content_crud.inc, line 177
Create/Read/Update/Delete functions for CCK-defined object types.

Code

function content_type_delete($info) {

  // Don't delete data for content-type defined by disabled modules.
  if (!empty($info->disabled)) {
    return;
  }
  $type = content_types($info->type);
  foreach ($type['fields'] as $field) {
    content_field_instance_delete(array(
      'type_name' => $info->type,
      'field_name' => $field['field_name'],
    ));
  }
  $table = _content_tablename($type['type'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
  if (db_table_exists($table)) {
    db_query('DROP TABLE {' . $table . '}');
    drupal_set_message(t('The content fields table %name has been deleted.', array(
      '%name' => $table,
    )));
  }

  // Reset all content type info.
  content_clear_type_cache();
}