public function ContentTranslationHandler::entityFormDelete in Drupal 10
Same name and namespace in other branches
- 8 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDelete()
- 9 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDelete()
Form submission handler for ContentTranslationHandler::entityFormAlter().
Takes care of entity deletion.
File
- core/
modules/ content_translation/ src/ ContentTranslationHandler.php, line 763
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translationCode
public function entityFormDelete($form, FormStateInterface $form_state) {
$form_object = $form_state
->getFormObject();
$entity = $form_object
->getEntity();
if (count($entity
->getTranslationLanguages()) > 1) {
$this->messenger
->addWarning(t('This will delete all the translations of %label.', [
'%label' => $entity
->label() ?? $entity
->id(),
]));
}
}