Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / entity_presave.twig
1 /**
2  * Implements hook_entity_presave().
3  */
4 function {{ machine_name }}_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
5   if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) {
6     $route_match = \Drupal::routeMatch();
7     \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode'));
8   }
9 }