X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Fsrc%2FForm%2FConfirmDeleteMultiple.php;h=825b0af6905504da10d26efdbaa982652009a7a0;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=590624831632a47541b5d7c3f394bc90cf727533;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/comment/src/Form/ConfirmDeleteMultiple.php b/web/core/modules/comment/src/Form/ConfirmDeleteMultiple.php index 590624831..825b0af69 100644 --- a/web/core/modules/comment/src/Form/ConfirmDeleteMultiple.php +++ b/web/core/modules/comment/src/Form/ConfirmDeleteMultiple.php @@ -2,63 +2,21 @@ namespace Drupal\comment\Form; -use Drupal\comment\CommentStorageInterface; -use Drupal\Component\Utility\Html; -use Drupal\Core\Form\ConfirmFormBase; -use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Entity\Form\DeleteMultipleForm as EntityDeleteMultipleForm; use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides the comment multiple delete confirmation form. + * + * @internal */ -class ConfirmDeleteMultiple extends ConfirmFormBase { - - /** - * The comment storage. - * - * @var \Drupal\comment\CommentStorageInterface - */ - protected $commentStorage; - - /** - * An array of comments to be deleted. - * - * @var \Drupal\comment\CommentInterface[] - */ - protected $comments; - - /** - * Creates an new ConfirmDeleteMultiple form. - * - * @param \Drupal\comment\CommentStorageInterface $comment_storage - * The comment storage. - */ - public function __construct(CommentStorageInterface $comment_storage) { - $this->commentStorage = $comment_storage; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('comment') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'comment_multiple_delete_confirm'; - } +class ConfirmDeleteMultiple extends EntityDeleteMultipleForm { /** * {@inheritdoc} */ public function getQuestion() { - return $this->t('Are you sure you want to delete these comments and all their children?'); + return $this->formatPlural(count($this->selection), 'Are you sure you want to delete this comment and all its children?', 'Are you sure you want to delete these comments and all their children?'); } /** @@ -71,55 +29,15 @@ class ConfirmDeleteMultiple extends ConfirmFormBase { /** * {@inheritdoc} */ - public function getConfirmText() { - return $this->t('Delete comments'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $edit = $form_state->getUserInput(); - - $form['comments'] = [ - '#prefix' => '