You are here

public function StateListDeleteForm::submitForm in Country, State and City Fields 8

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

Overrides ContentEntityForm::submitForm

File

src/Form/StateListDeleteForm.php, line 44

Class

StateListDeleteForm
Provides a form for deleting a statelist entity.

Namespace

Drupal\country_state_city\Form

Code

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