function hook_field_attach_prepare_translation_alter

Perform alterations on field_attach_prepare_translation().

This hook is invoked after the field module has performed the operation.

Parameters

$entity: The entity being prepared for translation.

$context: An associative array containing:

  • entity_type: The type of $entity; e.g. 'node' or 'user'.
  • langcode: The language the entity will be translated to.
  • source_entity: The entity holding the field values to be translated.
  • source_langcode: The source language from which to translate.

Related topics

1 function implements hook_field_attach_prepare_translation_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

poll_field_attach_prepare_translation_alter in drupal/core/modules/poll/poll.module
Implements hook_field_attach_prepare_translation_alter().

File

drupal/core/modules/field/field.api.php, line 1147

Code

function hook_field_attach_prepare_translation_alter(&$entity, $context) {
  if ($context['entity_type'] == 'custom_entity_type') {
    $entity->custom_field = $context['source_entity']->custom_field;
  }
}