You are here

function i18n_sync_node_translation_default_field in Internationalization 7

Synchronize configurable field

Parameters

$field_info: Field API field information.

File

i18n_sync/i18n_sync.node.inc, line 126
Internationalization (i18n) package. Synchronization of translations

Code

function i18n_sync_node_translation_default_field($node, $translation, $field, $field_info) {
  switch ($field_info['field']['type']) {
    case 'file':
    case 'image':
      i18n_sync_node_translation_file_field($node, $translation, $field);
      break;
    default:

      // For fields that don't need special handling, just copy it over if defined.
      // Field languages are completely unconsistent, for not to say broken
      // both in Drupal core and entity translation. Let's hope this works.
      $source_lang = field_language('node', $node, $field);
      $translation_lang = field_language('node', $translation, $field);
      if (isset($node->{$field}[$source_lang])) {
        $translation->{$field}[$translation_lang] = $node->{$field}[$source_lang];
      }
      break;
  }
}