class DeleteForm

Same name in this branch
  1. 9 core/modules/forum/src/Form/DeleteForm.php \Drupal\forum\Form\DeleteForm
Same name and namespace in other branches
  1. 11.x core/modules/comment/src/Form/DeleteForm.php \Drupal\comment\Form\DeleteForm

Provides the comment delete confirmation form.

@internal

Hierarchy

Expanded class hierarchy of DeleteForm

File

core/modules/comment/src/Form/DeleteForm.php, line 12

Namespace

Drupal\comment\Form
View source
class DeleteForm extends ContentEntityDeleteForm {
  
  /**
   * {@inheritdoc}
   */
  public function getCancelUrl() {
    // Point to the entity of which this comment is a reply.
    return $this->entity
      ->get('entity_id')->entity
      ->toUrl();
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getRedirectUrl() {
    return $this->getCancelUrl();
  }
  
  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return $this->t('Any replies to this comment will be lost. This action cannot be undone.');
  }
  
  /**
   * {@inheritdoc}
   */
  protected function getDeletionMessage() {
    return $this->t('The comment and all its replies have been deleted.');
  }
  
  /**
   * {@inheritdoc}
   */
  public function logDeletionMessage() {
    $this->logger('comment')
      ->notice('Deleted comment @cid and its replies.', [
      '@cid' => $this->entity
        ->id(),
    ]);
  }

}

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