You are here

public function StepTwoForm::submitForm in TacJS 8

Same name and namespace in other branches
  1. 8.2 src/Form/Steps/StepTwoForm.php \Drupal\tacjs\Form\Steps\StepTwoForm::submitForm()

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/Steps/StepTwoForm.php, line 86

Class

StepTwoForm
Class StepOneForm.

Namespace

Drupal\tacjs\Form\Steps

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::getContainer()
    ->get('config.factory')
    ->getEditable('tacjs.admin_settings_form');
  $data = \Drupal::service('tacjs.settings')
    ->cleanValues($form_state
    ->getValues());

  // Save Values.
  foreach ($data as $k => $v) {
    $config
      ->set($k, $v);
  }
  $config
    ->save();

  // Redirect to step one.
  $form_state
    ->setRedirect('tacjs.admin_settings_form');
}