3 namespace Drupal\slick_ui\Form;
6 use Drupal\Core\Entity\EntityConfirmFormBase;
7 use Drupal\Core\Form\FormStateInterface;
10 * Builds the form to delete a Slick optionset.
12 class SlickDeleteForm extends EntityConfirmFormBase {
17 public function getQuestion() {
18 return $this->t('Are you sure you want to delete the Slick optionset %label?', ['%label' => $this->entity->label()]);
24 public function getCancelUrl() {
25 return new Url('entity.slick.collection');
31 public function getConfirmText() {
32 return $this->t('Delete');
38 public function submitForm(array &$form, FormStateInterface $form_state) {
39 $this->entity->delete();
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()]);
44 $form_state->setRedirectUrl($this->getCancelUrl());