You are here

public function IngredientDeleteForm::submitForm in Recipe 8.2

Delete the ingredient and log the event.

Overrides ContentEntityForm::submitForm

File

modules/ingredient/src/Form/IngredientDeleteForm.php, line 83

Class

IngredientDeleteForm
Provides a form for deleting an ingredient.

Namespace

Drupal\ingredient\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $entity = $this
    ->getEntity();
  $entity
    ->delete();
  $this->loggerChannel
    ->notice('@type: deleted %title.', [
    '@type' => $this->entity
      ->bundle(),
    '%title' => $this->entity
      ->label(),
  ]);
  $form_state
    ->setRedirect('ingredient.admin');
}