Commit 763f513d authored by alexpott's avatar alexpott

Issue #2587185 by jcnventura, Chi, swentel: Use number FAPI element in number field settings form

parent 754aa65b
......@@ -52,11 +52,11 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
'#default_value' => $this->getSetting('decimal_separator'),
'#weight' => 5,
);
$range = range(0, 10);
$elements['scale'] = array(
'#type' => 'select',
'#type' => 'number',
'#title' => t('Scale', array(), array('context' => 'decimal places')),
'#options' => array_combine($range, $range),
'#min' => 0,
'#max' => 10,
'#default_value' => $this->getSetting('scale'),
'#description' => t('The number of digits to the right of the decimal.'),
'#weight' => 6,
......
......@@ -69,20 +69,21 @@ public function storageSettingsForm(array &$form, FormStateInterface $form_state
$element = array();
$settings = $this->getSettings();
$range = range(10, 32);
$element['precision'] = array(
'#type' => 'select',
'#type' => 'number',
'#title' => t('Precision'),
'#options' => array_combine($range, $range),
'#min' => 10,
'#max' => 32,
'#default_value' => $settings['precision'],
'#description' => t('The total number of digits to store in the database, including those to the right of the decimal.'),
'#disabled' => $has_data,
);
$range = range(0, 10);
$element['scale'] = array(
'#type' => 'select',
'#type' => 'number',
'#title' => t('Scale', array(), array('context' => 'decimal places')),
'#options' => array_combine($range, $range),
'#min' => 0,
'#max' => 10,
'#default_value' => $settings['scale'],
'#description' => t('The number of digits to the right of the decimal.'),
'#disabled' => $has_data,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment