function translation_entity_field_attach_presave

Implements hook_field_attach_presave().

File

drupal/core/modules/translation_entity/translation_entity.module, line 867
Allows entities to be translated into different languages.

Code

function translation_entity_field_attach_presave(EntityInterface $entity) {
  if ($entity
    ->isTranslatable()) {
    $attributes = drupal_container()
      ->get('request')->attributes;
    Drupal::service('translation_entity.synchronizer')
      ->synchronizeFields($entity, $attributes
      ->get('working_langcode'), $attributes
      ->get('source_langcode'));
  }
}