You are here

public function DeleteForm::submitForm in Domain Access 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

domain_config_ui/src/Form/DeleteForm.php, line 91

Class

DeleteForm
Class DeleteForm.

Namespace

Drupal\domain_config_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $name = $form_state
    ->getValue('config_name');
  $message = $this
    ->t('Domain configuration %label has been deleted.', [
    '%label' => $name,
  ]);
  \Drupal::messenger()
    ->addMessage($message);
  \Drupal::logger('domain_config')
    ->notice($message);
  \Drupal::configFactory()
    ->getEditable($name)
    ->delete();
  $form_state
    ->setRedirectUrl(new Url('domain_config_ui.list'));
}