/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->store->set('age', $form_state->getValue('age')); $this->store->set('location', $form_state->getValue('location')); // Save the data parent::saveData(); $form_state->setRedirect('multistep_form.multistep_one'); }
/** * {@inheritdoc}. */ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); $form['name'] = array('#type' => 'textfield', '#title' => $this->t('Your name'), '#default_value' => $this->store->get('name') ? $this->store->get('name') : ''); $form['email'] = array('#type' => 'email', '#title' => $this->t('Your email address'), '#default_value' => $this->store->get('email') ? $this->store->get('email') : ''); $form['actions']['submit']['#value'] = $this->t('Next'); return $form; }