3 namespace Drupal\redirect\Form;
5 use Drupal\Core\Entity\ContentEntityConfirmFormBase;
7 use Drupal\Core\Form\FormStateInterface;
9 class RedirectDeleteForm extends ContentEntityConfirmFormBase {
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()));
21 public function getCancelUrl() {
22 return new Url('redirect.list');
28 public function getConfirmText() {
29 return $this->t('Delete');
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');