48c83dc8386930408df0888060f3401797009cf3
[yaffs-website] / Form / FeedItemsDeleteForm.php
1 <?php
2
3 namespace Drupal\aggregator\Form;
4
5 use Drupal\Core\Entity\ContentEntityConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\Core\Url;
8
9 /**
10  * Provides a deletion confirmation form for items that belong to a feed.
11  */
12 class FeedItemsDeleteForm extends ContentEntityConfirmFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getQuestion() {
18     return $this->t('Are you sure you want to delete all items from the feed %feed?', ['%feed' => $this->entity->label()]);
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getCancelUrl() {
25     return new Url('aggregator.admin_overview');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getConfirmText() {
32     return $this->t('Delete items');
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function submitForm(array &$form, FormStateInterface $form_state) {
39     $this->entity->deleteItems();
40
41     $form_state->setRedirectUrl($this->getCancelUrl());
42   }
43
44 }