function hook_entity_presave(\Drupal\Core\Entity\EntityInterface
$entity) { if ($entity instanceof ContentEntityInterface &&
$entity->
isTranslatable()) { $route_match = \Drupal::
routeMatch();
\Drupal::
service('content_translation.synchronizer'
)->
synchronizeFields($entity,
$entity->
language()->
getId(),
$route_match->
getParameter('source_langcode'
));
}}/**
* Act on a specific type of entity before it is created or updated.
*
* You can get the original entity object from $entity->original when it is an
* update of the entity.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
*
* @ingroup entity_crud
* @see hook_entity_presave()
*/