/** * {@inheritdoc}. */ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); $form['age'] = array('#type' => 'textfield', '#title' => $this->t('Your age'), '#default_value' => $this->store->get('age') ? $this->store->get('age') : ''); $form['location'] = array('#type' => 'textfield', '#title' => $this->t('Your location'), '#default_value' => $this->store->get('location') ? $this->store->get('location') : ''); $form['actions']['previous'] = array('#type' => 'link', '#title' => $this->t('Previous'), '#attributes' => array('class' => array('button')), '#weight' => 0, '#url' => Url::fromRoute('demo.multistep_one')); return $form; }
/** * {@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; }