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
d3a7d136
Commit
d3a7d136
authored
Nov 21, 2014
by
alexpott
Browse files
Issue
#2376689
by yched: IntegerItem 'size' setting should be a storage setting
parent
9bb4f4cf
Changes
3
Show whitespace changes
Inline
Side-by-side
core/config/schema/core.data_types.schema.yml
View file @
d3a7d136
...
...
@@ -622,11 +622,15 @@ field.email.value:
# Schema for the configuration of the Integer field type.
field.integer.storage_settings
:
type
:
sequence
type
:
mapping
label
:
'
Integer
settings'
sequence
:
-
type
:
string
label
:
'
setting'
mapping
:
unsigned
:
type
:
boolean
label
:
'
Unsigned'
size
:
type
:
string
label
:
'
Database
storage
size'
field.integer.field_settings
:
type
:
mapping
...
...
@@ -644,9 +648,6 @@ field.integer.field_settings:
suffix
:
type
:
string
label
:
'
Suffix'
size
:
type
:
string
label
:
'
Database
storage
size'
field.integer.value
:
type
:
sequence
...
...
core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php
View file @
d3a7d136
...
...
@@ -30,6 +30,9 @@ class IntegerItem extends NumericItemBase {
public
static
function
defaultStorageSettings
()
{
return
array
(
'unsigned'
=>
FALSE
,
// Valid size property values include: 'tiny', 'small', 'medium', 'normal'
// and 'big'.
'size'
=>
'normal'
,
)
+
parent
::
defaultStorageSettings
();
}
...
...
@@ -42,9 +45,6 @@ public static function defaultFieldSettings() {
'max'
=>
''
,
'prefix'
=>
''
,
'suffix'
=>
''
,
// Valid size property values include: 'tiny', 'small', 'medium', 'normal'
// and 'big'.
'size'
=>
'normal'
,
)
+
parent
::
defaultFieldSettings
();
}
...
...
core/modules/field/src/Tests/Number/NumberFieldTest.php
View file @
d3a7d136
...
...
@@ -143,11 +143,12 @@ function testNumberIntegerField() {
// Create a field with settings to validate.
$field_name
=
Unicode
::
strtolower
(
$this
->
randomMachineName
());
entity_create
(
'field_storage_config'
,
array
(
$storage
=
entity_create
(
'field_storage_config'
,
array
(
'field_name'
=>
$field_name
,
'entity_type'
=>
'entity_test'
,
'type'
=>
'integer'
,
))
->
save
();
));
$storage
->
save
();
entity_create
(
'field_config'
,
array
(
'field_name'
=>
$field_name
,
...
...
@@ -172,6 +173,22 @@ function testNumberIntegerField() {
))
->
save
();
// Check the storage schema.
$expected
=
array
(
'columns'
=>
array
(
'value'
=>
array
(
'type'
=>
'int'
,
'not null'
=>
FALSE
,
'unsigned'
=>
''
,
'size'
=>
'normal'
),
),
'unique keys'
=>
array
(),
'indexes'
=>
array
(),
'foreign keys'
=>
array
()
);
$this
->
assertEqual
(
$storage
->
getSchema
(),
$expected
);
// Display creation form.
$this
->
drupalGet
(
'entity_test/add'
);
$this
->
assertFieldByName
(
"
{
$field_name
}
[0][value]"
,
''
,
'Widget is displayed'
);
...
...
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