Version 1
[yaffs-website] / web / core / modules / comment / src / Form / DeleteForm.php
1 <?php
2
3 namespace Drupal\comment\Form;
4
5 use Drupal\Core\Entity\ContentEntityDeleteForm;
6
7 /**
8  * Provides the comment delete confirmation form.
9  */
10 class DeleteForm extends ContentEntityDeleteForm {
11
12   /**
13    * {@inheritdoc}
14    */
15   public function getCancelUrl() {
16     // Point to the entity of which this comment is a reply.
17     return $this->entity->get('entity_id')->entity->urlInfo();
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function getRedirectUrl() {
24     return $this->getCancelUrl();
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function getDescription() {
31     return $this->t('Any replies to this comment will be lost. This action cannot be undone.');
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   protected function getDeletionMessage() {
38     return $this->t('The comment and all its replies have been deleted.');
39   }
40
41   /**
42    * {@inheritdoc}
43    */
44   public function logDeletionMessage() {
45     $this->logger('comment')->notice('Deleted comment @cid and its replies.', ['@cid' => $this->entity->id()]);
46   }
47
48 }