PetDeleteForm.php in Previewable email templates 8
Same filename and directory in other branches
Namespace
Drupal\pet\FormFile
src/Form/PetDeleteForm.phpView source
<?php
namespace Drupal\pet\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;
class PetDeleteForm extends ContentEntityDeleteForm {
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
$this
->logger('content')
->notice('@type: deleted %title.', [
'@type' => $this->entity
->bundle(),
'%title' => $this->entity
->label(),
]);
$pet_storage = $this->entityTypeManager
->getStorage('pet');
$pet = $pet_storage
->load($this->entity
->bundle());
\Drupal::messenger()
->addMessage($this
->t('@type %title has been deleted.', [
'@type' => $pet,
'%title' => $this->entity
->label(),
]));
$form_state
->setRedirect('entity.pet.collection');
}
}
Classes
Name | Description |
---|---|
PetDeleteForm |