1 field.default.inc field_default_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode)

Copies source field values into the entity to be prepared.


$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.


core/modules/field/field.default.inc, line 264
Default 'implementations' of hook_field_*(): common field housekeeping.


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];