You are here

protected function NodeDeleteForm::getDeletionMessage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/src/Form/NodeDeleteForm.php \Drupal\node\Form\NodeDeleteForm::getDeletionMessage()

Overrides ContentEntityDeleteForm::getDeletionMessage

File

core/modules/node/src/Form/NodeDeleteForm.php, line 17

Class

NodeDeleteForm
Provides a form for deleting a node.

Namespace

Drupal\node\Form

Code

protected function getDeletionMessage() {

  /** @var \Drupal\node\NodeInterface $entity */
  $entity = $this
    ->getEntity();
  $node_type_storage = $this->entityTypeManager
    ->getStorage('node_type');
  $node_type = $node_type_storage
    ->load($entity
    ->bundle())
    ->label();
  if (!$entity
    ->isDefaultTranslation()) {
    return $this
      ->t('@language translation of the @type %label has been deleted.', [
      '@language' => $entity
        ->language()
        ->getName(),
      '@type' => $node_type,
      '%label' => $entity
        ->label(),
    ]);
  }
  return $this
    ->t('The @type %title has been deleted.', [
    '@type' => $node_type,
    '%title' => $this
      ->getEntity()
      ->label(),
  ]);
}