You are here

public function ContentTranslationHandler::entityFormDelete in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::entityFormDelete()
  2. 10 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_translation

Code

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(),
    ]));
  }
}