AuthorPaneDeleteForm.php in Author Pane 8.3
File
src/Form/AuthorPaneDeleteForm.php
View source
<?php
namespace Drupal\author_pane\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
class AuthorPaneDeleteForm extends EntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete AuthorPane %label?', array(
'%label' => $this->entity
->label(),
));
}
public function getConfirmText() {
return $this
->t('Delete AuthorPane');
}
public function getCancelUrl() {
return new Url('entity.author_pane.list');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
drupal_set_message($this
->t('Robot %label was deleted.', array(
'%label' => $this->entity
->label(),
)));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}