1 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

File

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

Code

function hook_node_type_update($info) {
  // Update a setting that pointed at the old type name to the new type name.
  if (!empty($info->old_type) && $info->old_type != $info->type) {
    $config = config('my_module.settings');
    $default_type = $config->get('default_node_type');
    if ($default_type === $info->old_type) {
      $config->set('default_node_type', $info->type);
    }
  }
}