public function TwoForm::buildForm in Chaos Tool Suite (ctools) 8.3
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- tests/
modules/ ctools_wizard_test/ src/ Form/ TwoForm.php, line 34
Class
- TwoForm
- Simple wizard step form.
Namespace
Drupal\ctools_wizard_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
$form['two'] = [
'#title' => $this
->t('Two'),
'#type' => 'textfield',
'#default_value' => !empty($cached_values['two']) ? $cached_values['two'] : '',
];
$form['dynamic'] = [
'#title' => $this
->t('Dynamic value'),
'#type' => 'item',
'#markup' => !empty($cached_values['dynamic']) ? $cached_values['dynamic'] : '',
];
return $form;
}