7.x node.api.php hook_node_type_update($info)

Respond to node type updates.

This hook is invoked from node_type_save() after the node type is updated in the database.

Parameters

$info: The node type object that is being updated.

Related topics

3 functions implement hook_node_type_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_node_type_update in modules/book/book.module
Implements hook_node_type_update().
comment_node_type_update in modules/comment/comment.module
Implements hook_node_type_update().
node_node_type_update in modules/node/content_types.inc
Implements hook_node_type_update().
1 invocation of hook_node_type_update()
node_type_save in modules/node/node.module
Saves a node type to the database.

File

modules/node/node.api.php, line 1016
Hooks provided by the Node module.

Code

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);
  }
}

Comments

sciron256’s picture

After beating my head against the proverbial wall programmatically creating and deleting content with custom fields, this one has me scratching my head.
v7.26 - why is it *assumed* 'comment' is installed?
If I am wrong and it's not, then why are the variable_del('comment_' lines there?

I was unable to find any issue reports with Drupal core regarding this, and the documentation is not terribly clear. All of the documentation regarding variable_del and COMMENT_NODE_OPEN lead me to these conclusions. Clarity would be appreciated.

Regards.

sciron256’s picture

https://api.drupal.org/comment/54713#comment-54713

Thank you chadhester for leading me in the right direction.