entity_change_notifier-8.x-1.0/src/Form/PublisherDeleteForm.php
src/Form/PublisherDeleteForm.php
<?php
namespace Drupal\entity_change_notifier\Form;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Builds the form to delete Publisher entities.
*/
class PublisherDeleteForm extends EntityDeleteForm {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'ecn_publisher_delete_form';
}
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message(
$this->t('The @type %label has been deleted.',
[
'@type' => $this->entity->getEntityType()->getLabel(),
'%label' => $this->entity->label(),
]
)
);
$form_state->setRedirectUrl($this->getCancelUrl());
}
}
