Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / aggregator / src / 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  * @internal
13  */
14 class FeedItemsDeleteForm extends ContentEntityConfirmFormBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function getQuestion() {
20     return $this->t('Are you sure you want to delete all items from the feed %feed?', ['%feed' => $this->entity->label()]);
21   }
22
23   /**
24    * {@inheritdoc}
25    */
26   public function getCancelUrl() {
27     return new Url('aggregator.admin_overview');
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function getConfirmText() {
34     return $this->t('Delete items');
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   public function submitForm(array &$form, FormStateInterface $form_state) {
41     $this->entity->deleteItems();
42
43     $form_state->setRedirectUrl($this->getCancelUrl());
44   }
45
46 }