public function ModalDeleteForm::submitForm in Modal 8.3
Same name and namespace in other branches
- 8.2 src/Form/ModalDeleteForm.php \Drupal\modal_page\Form\ModalDeleteForm::submitForm()
- 5.0.x src/Form/ModalDeleteForm.php \Drupal\modal_page\Form\ModalDeleteForm::submitForm()
- 4.0.x src/Form/ModalDeleteForm.php \Drupal\modal_page\Form\ModalDeleteForm::submitForm()
- 4.1.x src/Form/ModalDeleteForm.php \Drupal\modal_page\Form\ModalDeleteForm::submitForm()
Delete the entity and log the event. logger() replaces the watchdog.
Overrides ContentEntityForm::submitForm
File
- src/
Form/ ModalDeleteForm.php, line 40
Class
- ModalDeleteForm
- Class: ModalDeleteForm.
Namespace
Drupal\modal_page\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this
->getEntity();
$entity
->delete();
$this
->logger('modal_page')
->notice('@type: deleted %title.', [
'@type' => $this->entity
->bundle(),
'%title' => $this->entity
->label(),
]);
$this
->messenger()
->addStatus($this
->t('Modal %title deleted.', [
'%title' => $this->entity
->label(),
]));
$form_state
->setRedirect('modal_page.default');
}