public function NumericBase::form in YAML Form 8
Gets the actual configuration form array to be built.
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 An associative array contain the element's configuration form without any default values..
Overrides YamlFormElementBase::form
1 call to NumericBase::form()
- Range::form in src/
Plugin/ YamlFormElement/ Range.php - Gets the actual configuration form array to be built.
1 method overrides NumericBase::form()
- Range::form in src/
Plugin/ YamlFormElement/ Range.php - Gets the actual configuration form array to be built.
File
- src/
Plugin/ YamlFormElement/ NumericBase.php, line 39
Class
- NumericBase
- Provides a base 'numeric' class.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['number'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Number settings'),
];
$form['number']['min'] = [
'#type' => 'number',
'#title' => $this
->t('Min'),
'#description' => $this
->t('Specifies the minimum value.'),
'#step' => 'any',
'#size' => 4,
];
$form['number']['max'] = [
'#type' => 'number',
'#title' => $this
->t('Max'),
'#description' => $this
->t('Specifies the maximum value.'),
'#step' => 'any',
'#size' => 4,
];
$form['number']['step'] = [
'#type' => 'number',
'#title' => $this
->t('Steps'),
'#description' => $this
->t('Specifies the legal number intervals. Leave blank to support any number interval.'),
'#step' => 'any',
'#size' => 4,
];
return $form;
}