Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / redirect / src / Form / RedirectDeleteForm.php
1 <?php
2
3 namespace Drupal\redirect\Form;
4
5 use Drupal\Core\Entity\ContentEntityConfirmFormBase;
6 use Drupal\Core\Url;
7 use Drupal\Core\Form\FormStateInterface;
8
9 class RedirectDeleteForm extends ContentEntityConfirmFormBase {
10
11   /**
12    * {@inheritdoc}
13    */
14   public function getQuestion() {
15     return $this->t('Are you sure you want to delete the URL redirect from %source to %redirect?', array('%source' => $this->entity->getSourceUrl(), '%redirect' => $this->entity->getRedirectUrl()->toString()));
16   }
17
18   /**
19    * {@inheritdoc}
20    */
21   public function getCancelUrl() {
22     return new Url('redirect.list');
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public function getConfirmText() {
29     return $this->t('Delete');
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function submitForm(array &$form, FormStateInterface $form_state) {
36     $this->entity->delete();
37     drupal_set_message($this->t('The redirect %redirect has been deleted.', array('%redirect' => $this->entity->getRedirectUrl()->toString())));
38     $form_state->setRedirect('redirect.list');
39   }
40
41 }