You are here

public function ConfigDeleteConfirm::submitForm in Demonstration site (Sandbox / Snapshot) 8

.

Overrides FormInterface::submitForm

File

src/Form/ConfigDeleteConfirm.php, line 50

Class

ConfigDeleteConfirm
confirms the deletion of config deletion

Namespace

Drupal\demo\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $filename = $form_state
    ->getValue('filename');
  unlink($filename);
  \Drupal::messenger()
    ->addMessage(t('Snapshot %title has been deleted.', [
    '%title' => $form_state
      ->getValue([
      'filename',
    ]),
  ]));
  $form_state
    ->setRedirect('demo.manage_config');
}