function ContentTranslationHandler::entityFormDelete
Same name in other branches
- 8.9.x core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDelete()
- 10 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDelete()
- 11.x 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 764
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(),
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.