function NodeDeleteForm::getDeletionMessage

Same name in other branches
  1. 9 core/modules/node/src/Form/NodeDeleteForm.php \Drupal\node\Form\NodeDeleteForm::getDeletionMessage()
  2. 8.9.x core/modules/node/src/Form/NodeDeleteForm.php \Drupal\node\Form\NodeDeleteForm::getDeletionMessage()
  3. 11.x 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());
    if (!$entity->isDefaultTranslation()) {
        return $this->t('@language translation of the @type %label has been deleted.', [
            '@language' => $entity->language()
                ->getName(),
            '@type' => $node_type->label(),
            '%label' => $entity->label(),
        ]);
    }
    return $this->t('The @type %title has been deleted.', [
        '@type' => $node_type->label(),
        '%title' => $this->getEntity()
            ->label(),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.