return $form;
} /**
* {@inheritdoc}
*/
public function submitForm(array &
$form, FormStateInterface
$form_state) { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity =
$this->
getEntity();
$message =
$this->
getDeletionMessage();
// Make sure that deleting a translation does not delete the whole entity.
if (!
$entity->
isDefaultTranslation()) { $untranslated_entity =
$entity->
getUntranslated();
$untranslated_entity->
removeTranslation($entity->
language()->
getId());
$untranslated_entity->
save();
$form_state->
setRedirectUrl($untranslated_entity->
toUrl('canonical'
));
} else { $entity->
delete();
$form_state->
setRedirectUrl($this->
getRedirectUrl());
}