file_transfer-8.x-2.0-beta2/src/Form/FileTransferDeleteForm.php
src/Form/FileTransferDeleteForm.php
<?php
namespace Drupal\file_transfer\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
/**
* Builds the form to delete an filetransfer.
*/
class FileTransferDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete %name?', array('%name' => $this->entity->label()));
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('entity.filetransfer.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$t_args = ['%label' => $this->entity->label()];
$this->entity->delete();
drupal_set_message(t('The %label filetransfer has been deleted.', $t_args));
$form_state->setRedirectUrl($this->getCancelUrl());
}
}
