function node_registration_node_type_update in Node registration 7
Implements hook_node_type_update().
File
- ./
node_registration.module, line 892
Code
function node_registration_node_type_update($info) {
if (!empty($info->old_type) && $info->old_type != $info->type) {
$old_type = $info->old_type;
$new_type = $info->type;
// Update registration variables.
$old_var_name = 'node_registration_type_settings_' . $old_type;
$new_var_name = 'node_registration_type_settings_' . $new_type;
db_update('variable')
->fields(array(
'name' => $new_var_name,
))
->condition('name', $old_var_name)
->execute();
// Update node_registration.type.
db_update('node_registration')
->fields(array(
'type' => $new_type,
))
->condition('type', $old_type)
->execute();
// Update node_registration.node_type.
db_update('node_registration')
->fields(array(
'node_type' => $new_type,
))
->condition('node_type', $old_type)
->execute();
drupal_flush_all_caches();
}
}