Same name and namespace in other branches
- 6.x developer/hooks/node.php \hook_node_type()
Act on node type changes.
This hook allows modules to take action when a node type is modified.
Parameters
$op: What is being done to $info. Possible values:
- "delete"
- "insert"
- "update"
$info: The node type object on which $op is being performed.
Return value
None.
Related topics
3 functions implement hook_node_type()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- node_node_type in modules/
node/ content_types.inc - Implementation of hook_node_type().
- system_node_type in modules/
system/ system.module - Implementation of hook_node_type().
- taxonomy_node_type in modules/
taxonomy/ taxonomy.module - Implementation of hook_node_type().
2 invocations of hook_node_type()
- node_type_delete in modules/
node/ node.module - Deletes a node type from the database.
- node_type_save in modules/
node/ node.module - Saves a node type to the database.
File
- developer/
hooks/ node.php, line 93 - These hooks are defined by node modules, modules that define a new kind of node.
Code
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_READ_WRITE);
variable_del('comment_' . $info->old_type);
variable_set('comment_' . $info->type, $setting);
}
break;
}
}