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 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 modules/poll/poll.module
Implements hook_field_attach_prepare_translation_alter().

File

modules/field/field.api.php, line 1534

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.