You are here

function i18n_sync_node_translation_nodereference_field in Internationalization 7

Translating a nodereference field (cck).

File

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

Code

function i18n_sync_node_translation_nodereference_field(&$node, &$translation, $field) {
  $translated_references = array();
  foreach ($node->{$field} as $reference) {
    if ($reference_node = node_load($reference['nid'])) {
      $translated_references[] = array(
        'nid' => i18n_sync_node_translation_reference_field($reference_node, $reference['nid'], $translation->language),
      );
    }
  }
  $translation->{$field} = $translated_references;
}