1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\Form\{{ entity_class }}DeleteForm.
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\Form;
12 use Drupal\Core\Entity\EntityConfirmFormBase;
13 use Drupal\Core\Form\FormStateInterface;
17 {% block class_declaration %}
19 * Builds the form to delete {{ label }} entities.
21 class {{ entity_class }}DeleteForm extends EntityConfirmFormBase {% endblock %}
22 {% block class_methods %}
26 public function getQuestion() {
27 return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
33 public function getCancelUrl() {
34 return new Url('entity.{{ entity_name }}.collection');
40 public function getConfirmText() {
41 return $this->t('Delete');
47 public function submitForm(array &$form, FormStateInterface $form_state) {
48 $this->entity->delete();
51 $this->t('content @type: deleted @label.',
53 '@type' => $this->entity->bundle(),
54 '@label' => $this->entity->label(),
59 $form_state->setRedirectUrl($this->getCancelUrl());