Contributions API

i18nsync_node_translation_attached_node

Definition

i18nsync_node_translation_attached_node(&$node, &$translation, $field)
contributions/i18n/i18nsync/i18nsync.module, line 244

Description

Node attachments (CCK) that may have translation

Code

<?php
function i18nsync_node_translation_attached_node(&$node, &$translation, $field) {
  if (isset($node->$field) && $attached = node_load($node->$field)) {
    if (translation_supported_type($attached->type)) {
      // This content type has translations, find the one
      if (($attachedtrans = translation_node_get_translations($attached)) && isset($attachedtrans[$translation->language])) {
        $translation->$field = $attachedtrans[$translation->language]->nid;
      }
    } else {
      // Content type without language, just copy the nid
      $translation->$field = $node->$field;
    }
  }
}
?>