EmailDeleteForm.php in Courier 2.x
File
src/Form/EmailDeleteForm.php
View source
<?php
namespace Drupal\courier\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
class EmailDeleteForm extends ContentEntityConfirmFormBase {
public function getQuestion() {
return t('Are you sure you want to delete this email?');
}
public function getCancelUrl() {
return $this->entity
->toUrl();
}
public function getConfirmText() {
return t('Delete');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$email = $this->entity;
$email
->delete();
$this
->messenger()
->addMessage($this
->t('Email deleted.'));
}
}