96b494ebde1a499188d1d87ad5c277de03af45bc
[yaffs-website] / web / modules / contrib / slick / slick_ui / src / Form / SlickDeleteForm.php
1 <?php
2
3 namespace Drupal\slick_ui\Form;
4
5 use Drupal\Core\Url;
6 use Drupal\Core\Entity\EntityConfirmFormBase;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * Builds the form to delete a Slick optionset.
11  */
12 class SlickDeleteForm extends EntityConfirmFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function getQuestion() {
18     return $this->t('Are you sure you want to delete the Slick optionset %label?', ['%label' => $this->entity->label()]);
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getCancelUrl() {
25     return new Url('entity.slick.collection');
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function getConfirmText() {
32     return $this->t('Delete');
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function submitForm(array &$form, FormStateInterface $form_state) {
39     $this->entity->delete();
40
41     drupal_set_message($this->t('The Slick optionset %label has been deleted.', ['%label' => $this->entity->label()]));
42     $this->logger('user')->notice('Deleted optionset %oid (%label)', ['%oid' => $this->entity->id(), '%label' => $this->entity->label()]);
43
44     $form_state->setRedirectUrl($this->getCancelUrl());
45   }
46
47 }