You are here

function globallink_node_type_update in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink.module \globallink_node_type_update()
  2. 7.6 globallink.module \globallink_node_type_update()

Implements hook_node_type_update().

File

./globallink.module, line 637
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_core')
    ->fields(array(
    'type' => $info->orig_type,
  ))
    ->condition('type', $info->old_type, '=')
    ->execute();
}