Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / node / src / Form / NodeDeleteForm.php
1 <?php
2
3 namespace Drupal\node\Form;
4
5 use Drupal\Core\Entity\ContentEntityDeleteForm;
6
7 /**
8  * Provides a form for deleting a node.
9  *
10  * @internal
11  */
12 class NodeDeleteForm extends ContentEntityDeleteForm {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function getDeletionMessage() {
18     /** @var \Drupal\node\NodeInterface $entity */
19     $entity = $this->getEntity();
20
21     $node_type_storage = $this->entityManager->getStorage('node_type');
22     $node_type = $node_type_storage->load($entity->bundle())->label();
23
24     if (!$entity->isDefaultTranslation()) {
25       return $this->t('@language translation of the @type %label has been deleted.', [
26         '@language' => $entity->language()->getName(),
27         '@type' => $node_type,
28         '%label' => $entity->label(),
29       ]);
30     }
31
32     return $this->t('The @type %title has been deleted.', [
33       '@type' => $node_type,
34       '%title' => $this->getEntity()->label(),
35     ]);
36   }
37
38   /**
39    * {@inheritdoc}
40    */
41   protected function logDeletionMessage() {
42     /** @var \Drupal\node\NodeInterface $entity */
43     $entity = $this->getEntity();
44     $this->logger('content')->notice('@type: deleted %title.', ['@type' => $entity->getType(), '%title' => $entity->label()]);
45   }
46
47 }