function globallink_node_type_update in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink.module \globallink_node_type_update()
- 7.6 globallink.module \globallink_node_type_update()
Implements hook_node_type_update().
File
- ./
globallink.module, line 714 - GlobalLink translation module.
Code
function globallink_node_type_update($info) {
if (!$info->modified) {
return;
}
if (count(globallink_get_translatable_fields($info->old_type)) == 0) {
if (globallink_translation_supported($info->type)) {
globallink_insert_all_fields($info->type);
}
return;
}
if (!globallink_translation_supported($info->type)) {
globallink_delete_field_configs($info->type);
return;
}
db_update('globallink_field_config')
->fields(array(
'content_type' => $info->orig_type,
))
->condition('content_type', $info->old_type, '=')
->execute();
db_update('globallink_field_config')
->fields(array(
'bundle' => $info->orig_type,
))
->condition('bundle', $info->old_type, '=')
->execute();
db_update('globallink_document')
->fields(array(
'object_type' => $info->orig_type,
))
->condition('object_type', $info->old_type, '=')
->condition(db_or()
->condition('entity_type', GLOBALLINK_ENTITY_TYPE_NODE, '=')
->condition('entity_type', GLOBALLINK_ENTITY_TYPE_ENTITY, '='))
->execute();
}