hook_node_type
- Versions
- 5 – 6
hook_node_type($op, $info)
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
Code
developer/hooks/node.php, line 93
<?php
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;
}
}
?>Login or register to post comments 