Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
763f513d
Commit
763f513d
authored
Feb 04, 2016
by
alexpott
Browse files
Issue
#2587185
by jcnventura, Chi, swentel: Use number FAPI element in number field settings form
parent
754aa65b
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php
View file @
763f513d
...
...
@@ -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
,
...
...
core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php
View file @
763f513d
...
...
@@ -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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment