You are here

public function DemoConfigManageForm::submitForm in Demonstration site (Sandbox / Snapshot) 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

src/Form/DemoConfigManageForm.php, line 42

Class

DemoConfigManageForm
This class returns the demo_config_manage_form in which there will be a button to create the snapshot of the configuration.

Namespace

Drupal\demo\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->setRedirect('demo.export_download')) {
    \Drupal::messenger()
      ->addMessage(t('Snapshot has been created.'));
  }
  else {
    \Drupal::messenger()
      ->addMessage(t('Snapshot not created.'));
  }
}