You are here

public function CountryListDeleteForm::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/CountryListDeleteForm.php, line 44

Class

CountryListDeleteForm
Provides a form for deleting a countrylist entity.

Namespace

Drupal\country_state_city\Form

Code

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