You are here

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

Class

CityListDeleteForm
Provides a form for deleting a citylist entity.

Namespace

Drupal\country_state_city\Form

Code

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