You are here

public function EntityDeleteFormTrait::submitForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php \Drupal\Core\Entity\EntityDeleteFormTrait::submitForm()
  2. 9 core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php \Drupal\Core\Entity\EntityDeleteFormTrait::submitForm()
2 calls to EntityDeleteFormTrait::submitForm()
ImageStyleDeleteForm::submitForm in core/modules/image/src/Form/ImageStyleDeleteForm.php
MenuDeleteForm::submitForm in core/modules/menu_ui/src/Form/MenuDeleteForm.php
4 methods override EntityDeleteFormTrait::submitForm()
ContentEntityDeleteForm::submitForm in core/lib/Drupal/Core/Entity/ContentEntityDeleteForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
FieldConfigDeleteForm::submitForm in core/modules/field_ui/src/Form/FieldConfigDeleteForm.php
ImageStyleDeleteForm::submitForm in core/modules/image/src/Form/ImageStyleDeleteForm.php
MenuDeleteForm::submitForm in core/modules/menu_ui/src/Form/MenuDeleteForm.php

File

core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php, line 121

Class

EntityDeleteFormTrait
Provides a trait for an entity deletion form.

Namespace

Drupal\Core\Entity

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->getEntity()
    ->delete();
  $this
    ->messenger()
    ->addStatus($this
    ->getDeletionMessage());
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
  $this
    ->logDeletionMessage();
}