diff options
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/content_types.inc | 5 | ||||
-rw-r--r-- | modules/node/node.module | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index 5a22f363c..368a44985 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -331,7 +331,7 @@ function node_type_form_submit($form_id, $form_values) { * Implementation of hook_node_type(). */ function node_node_type($op, $info) { - if (!empty($info->old_type) && $info->old_type != $info->type) { + if ($op != 'delete' && !empty($info->old_type) && $info->old_type != $info->type) { $update_count = node_type_update_nodes($info->old_type, $info->type); if ($update_count) { @@ -387,7 +387,7 @@ function node_type_delete_confirm($type) { * Process content type delete confirm submissions. */ function node_type_delete_confirm_submit($form_id, $form_values) { - db_query("DELETE FROM {node_type} WHERE type = '%s'", $form_values['type']); + node_type_delete($form_values['type']); $t_args = array('%name' => $form_values['name']); drupal_set_message(t('The content type %name has been deleted.', $t_args)); @@ -398,4 +398,3 @@ function node_type_delete_confirm_submit($form_id, $form_values) { return 'admin/content/types'; } - diff --git a/modules/node/node.module b/modules/node/node.module index ae3a0a6d0..4c55d1aa6 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -295,6 +295,19 @@ function node_type_save($info) { } /** + * Deletes a node type from the database. + * + * @param $type + * The machine-readable name of the node type to be deleted. + */ +function node_type_delete($type) { + db_query("DELETE FROM {node_type} WHERE type = '%s'", $type); + + $info = node_get_types('type', $type); + module_invoke_all('node_type', 'delete', $info); +} + +/** * Updates all nodes of one type to be of another type. * * @param $orig_type |