hook_node_type
Definition
hook_node_type($op, $info)
developer/hooks/node.php, line 93
Description
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"
Return value
None.
Related topics
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
Code
<?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;
}
}
?> 