function EntityDeleteFormTrait::submitForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php \Drupal\Core\Entity\EntityDeleteFormTrait::submitForm()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php \Drupal\Core\Entity\EntityDeleteFormTrait::submitForm()
  3. 11.x 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.