function ContactDeleteForm::submitForm

Same name and namespace in other branches
  1. 4.0.x modules/content_entity_example/src/Form/ContactDeleteForm.php \Drupal\content_entity_example\Form\ContactDeleteForm::submitForm()

Delete the entity and log the event. logger() replaces the watchdog.

Overrides ContentEntityForm::submitForm

File

modules/content_entity_example/src/Form/ContactDeleteForm.php, line 44

Class

ContactDeleteForm
Provides a form for deleting a content_entity_example entity.

Namespace

Drupal\content_entity_example\Form

Code

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