public function ContentTranslationHandler::entityFormDeleteTranslation in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDeleteTranslation()
- 10 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDeleteTranslation()
Form submission handler for ContentTranslationHandler::entityFormAlter().
Takes care of content translation deletion.
File
- core/
modules/ content_translation/ src/ ContentTranslationHandler.php, line 770
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translationCode
public function entityFormDeleteTranslation($form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */
$form_object = $form_state
->getFormObject();
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $form_object
->getEntity();
$entity_type_id = $entity
->getEntityTypeId();
if ($entity
->access('delete') && $this->entityType
->hasLinkTemplate('delete-form')) {
$form_state
->setRedirectUrl($entity
->toUrl('delete-form'));
}
else {
$form_state
->setRedirect("entity.{$entity_type_id}.content_translation_delete", [
$entity_type_id => $entity
->id(),
'language' => $form_object
->getFormLangcode($form_state),
]);
}
}