StateDeleteForm.php in Booking and Availability Management Tools for Drupal 8
Contains \Drupal\bat_event\Form\Entity\StateDeleteForm.
Namespace
Drupal\bat_event\Entity\FormFile
modules/bat_event/src/Entity/Form/StateDeleteForm.phpView source
<?php
/**
* @file
* Contains \Drupal\bat_event\Form\Entity\StateDeleteForm.
*/
namespace Drupal\bat_event\Entity\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Builds the form to delete State entities.
*/
class StateDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete %name?', [
'%name' => $this->entity
->label(),
]);
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('entity.state.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
$this
->messenger()
->addMessage($this
->t('State @label has been deleted.', [
'@label' => $this->entity
->label(),
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}
Classes
Name | Description |
---|---|
StateDeleteForm | Builds the form to delete State entities. |