EntityExtraFieldFormDelete.php in Entity Extra Field 8
File
src/Form/EntityExtraFieldFormDelete.php
View source
<?php
namespace Drupal\entity_extra_field\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
class EntityExtraFieldFormDelete extends EntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete %label?', [
'%label' => $this->entity
->label(),
]);
}
public function getCancelUrl() {
return $this->entity
->toUrl('collection');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->entity
->delete();
}
}