EntityLegalDocumentDeleteForm.php in Entity Legal 8
Namespace
Drupal\entity_legal\FormFile
src/Form/EntityLegalDocumentDeleteForm.phpView source
<?php
/**
* @file
* Contains \Drupal\entity_legal\Form\EntityLegalDocumentDeleteForm.
*/
namespace Drupal\entity_legal\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
/**
* Form builder for legal document deletion.
*/
class EntityLegalDocumentDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delet %name', array(
'%name' => $this->entity
->label(),
));
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('entity_legal.list_documents');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
drupal_set_message($this
->t('Legal document %label has been deleted', array(
'%label' => $this->entity
->label(),
)));
$form_state
->setRedirect('entity_legal.list_documents');
}
}
Classes
Name | Description |
---|---|
EntityLegalDocumentDeleteForm | Form builder for legal document deletion. |