public function FormTestRangeForm::buildForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/form_test/src/Form/FormTestRangeForm.php \Drupal\form_test\Form\FormTestRangeForm::buildForm()
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
- core/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestRangeForm.php, line 29 - Contains \Drupal\form_test\Form\FormTestRangeForm.
Class
- FormTestRangeForm
- Form constructor for testing #type 'range' elements.
Namespace
Drupal\form_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['with_default_value'] = array(
'#type' => 'range',
'#title' => 'Range with default value',
'#min' => 10,
'#max' => 20,
'#step' => 2,
'#default_value' => 18,
'#description' => 'The default value is 18.',
);
$form['float'] = array(
'#type' => 'range',
'#title' => 'Float',
'#min' => 10,
'#max' => 11,
'#step' => 'any',
'#description' => 'Floating point number between 10 and 11.',
);
$form['integer'] = array(
'#type' => 'range',
'#title' => 'Integer',
'#min' => 2,
'#max' => 8,
'#step' => 2,
'#description' => 'Even integer between 2 and 8.',
);
$form['offset'] = array(
'#type' => 'range',
'#title' => 'Offset',
'#min' => 2.9,
'#max' => 10.9,
'#description' => 'Value between 2.9 and 10.9.',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}