From 84afe0d9275834a716edd826e8224e40cafa3746 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 11 Aug 2009 15:50:56 +0000 Subject: #545306 by alexanderpas: De-op hook_node_type(). --- modules/node/node.api.php | 50 ++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'modules/node/node.api.php') diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 818528082..24ccf1ffa 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -625,35 +625,45 @@ function hook_ranking() { } +/** + * Act on node type creation. + * + * This hook allows modules to take action when a node type is created. + * + * @param $info + * The node type object which is being created. + */ +function hook_node_type_insert($info) { +} + /** * Act on node type changes. * * This hook allows modules to take action when a node type is modified. * - * @param $op - * What is being done to $info. Possible values: - * - "delete" - * - "insert" - * - "update" * @param $info - * The node type object on which $op is being performed. - */ -function hook_node_type($op, $info) { - - switch ($op) { - case 'delete': - variable_del('comment_' . $info->type); - break; - case 'update': - if (!empty($info->old_type) && $info->old_type != $info->type) { - $setting = variable_get('comment_' . $info->old_type, COMMENT_NODE_OPEN); - variable_del('comment_' . $info->old_type); - variable_set('comment_' . $info->type, $setting); - } - break; + * The node type object which is being modified. + */ +function hook_node_type_update($info) { + if (!empty($info->old_type) && $info->old_type != $info->type) { + $setting = variable_get('comment_' . $info->old_type, COMMENT_NODE_OPEN); + variable_del('comment_' . $info->old_type); + variable_set('comment_' . $info->type, $setting); } } +/** + * Act on node type deletion. + * + * This hook allows modules to take action when a node type is deleted. + * + * @param $info + * The node type object which is being deleted. + */ +function hook_node_type_delete($info) { + variable_del('comment_' . $info->type); +} + /** * Define access restrictions. * -- cgit v1.2.3