function ContactDeleteForm::submitForm
Same name in other branches
- 3.x modules/content_entity_example/src/Form/ContactDeleteForm.php \Drupal\content_entity_example\Form\ContactDeleteForm::submitForm()
- 8.x-1.x content_entity_example/src/Form/ContactDeleteForm.php \Drupal\content_entity_example\Form\ContactDeleteForm::submitForm()
Delete the entity and log the event. logger() replaces the watchdog.
Overrides ContentEntityForm::submitForm
File
-
modules/
content_entity_example/ src/ Form/ ContactDeleteForm.php, line 44
Class
- ContactDeleteForm
- Provides a form for deleting a content_entity_example entity.
Namespace
Drupal\content_entity_example\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this->getEntity();
$entity->delete();
$this->logger('content_entity_example')
->notice('@type: deleted %title.', [
'@type' => $this->entity
->bundle(),
'%title' => $this->entity
->label(),
]);
$form_state->setRedirect('entity.content_entity_example_contact.collection');
}