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

8.1.x
Alex Pott 2016-02-04 13:40:23 +00:00
parent 754aa65b8e
commit 763f513da0
2 changed files with 10 additions and 9 deletions

View File

@ -52,11 +52,11 @@ class DecimalFormatter extends NumericFormatterBase {
'#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,

View File

@ -69,20 +69,21 @@ class DecimalItem extends NumericItemBase {
$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,