You are here

function i18nsync_node_translation_nodereference_field in Internationalization 6

Translating a nodereference field (cck).

1 call to i18nsync_node_translation_nodereference_field()
i18nsync_node_translation in i18nsync/i18nsync.module
Synchronizes fields for node translation.

File

i18nsync/i18nsync.module, line 372
Internationalization (i18n) package. Synchronization of translations

Code

function i18nsync_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' => i18nsync_node_translation_reference_field($reference_node, $reference['nid'], $translation->language),
      );
    }
  }
  $translation->{$field} = $translated_references;
}