/** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */
$form_object =
$form_state->
getFormObject();
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity =
$form_object->
getEntity();
// ContentEntityForm::submit will update the changed timestamp on submit
// after the entity has been validated, so that it does not break the
// EntityChanged constraint validator. The content translation metadata
// field for the changed timestamp does not have such a constraint defined
// at the moment, but it is correct to update its value in a submission
// handler as well and have the same logic like in the Form API.
if ($entity->
hasField('content_translation_changed'
)) { $metadata =
$this->manager->
getTranslationMetadata($entity);
$metadata->
setChangedTime(REQUEST_TIME
);
} } /**
* Form submission handler for ContentTranslationHandler::entityFormAlter().
*
* Takes care of the source language change.
*/
public function entityFormSourceChange($form, FormStateInterface
$form_state) {