function hook_field_attach_prepare_translation_alter

7.x field.api.php hook_field_attach_prepare_translation_alter(&$entity, $context)

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 has to be translated in.
  • source_entity: The entity holding the field values to be translated.
  • source_langcode: The source language from which 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/modules/poll/poll.module
Implements hook_field_attach_prepare_translation_alter().

File

drupal/modules/field/field.api.php, line 1534
Hooks provided by the Field module.

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