function EntityDeleteFormTrait::submitForm

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php \Drupal\Core\Entity\EntityDeleteFormTrait::submitForm()

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.