function field_default_prepare_translation
Copies source field values into the entity to be prepared.
Parameters
$entity_type: The type of $entity; e.g. 'node' or 'user'.
$entity: The entity to be prepared for translation.
$field: The field structure for the operation.
$instance: The instance structure for $field on $entity's bundle.
$langcode: The language the entity has to be translated in.
$items: $entity->{$field['field_name']}[$langcode], or an empty array if unset.
$source_entity: The source entity holding the field values to be translated.
$source_langcode: The source language from which translate.
1 invocation of field_default_prepare_translation()
- field_attach_prepare_translation in modules/field/ field.attach.inc 
- Prepares an entity for translation.
File
- 
              modules/field/ field.default.inc, line 259 
Code
function field_default_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode) {
  $field_name = $field['field_name'];
  // If the field is untranslatable keep using LANGUAGE_NONE.
  if ($langcode == LANGUAGE_NONE) {
    $source_langcode = LANGUAGE_NONE;
  }
  if (isset($source_entity->{$field_name}[$source_langcode])) {
    $items = $source_entity->{$field_name}[$source_langcode];
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
