Commit d3a7d136 authored by alexpott's avatar alexpott
Browse files

Issue #2376689 by yched: IntegerItem 'size' setting should be a storage setting

parent 9bb4f4cf
...@@ -622,11 +622,15 @@ field.email.value: ...@@ -622,11 +622,15 @@ field.email.value:
# Schema for the configuration of the Integer field type. # Schema for the configuration of the Integer field type.
field.integer.storage_settings: field.integer.storage_settings:
type: sequence type: mapping
label: 'Integer settings' label: 'Integer settings'
sequence: mapping:
- type: string unsigned:
label: 'setting' type: boolean
label: 'Unsigned'
size:
type: string
label: 'Database storage size'
field.integer.field_settings: field.integer.field_settings:
type: mapping type: mapping
...@@ -644,9 +648,6 @@ field.integer.field_settings: ...@@ -644,9 +648,6 @@ field.integer.field_settings:
suffix: suffix:
type: string type: string
label: 'Suffix' label: 'Suffix'
size:
type: string
label: 'Database storage size'
field.integer.value: field.integer.value:
type: sequence type: sequence
......
...@@ -30,6 +30,9 @@ class IntegerItem extends NumericItemBase { ...@@ -30,6 +30,9 @@ class IntegerItem extends NumericItemBase {
public static function defaultStorageSettings() { public static function defaultStorageSettings() {
return array( return array(
'unsigned' => FALSE, 'unsigned' => FALSE,
// Valid size property values include: 'tiny', 'small', 'medium', 'normal'
// and 'big'.
'size' => 'normal',
) + parent::defaultStorageSettings(); ) + parent::defaultStorageSettings();
} }
...@@ -42,9 +45,6 @@ public static function defaultFieldSettings() { ...@@ -42,9 +45,6 @@ public static function defaultFieldSettings() {
'max' => '', 'max' => '',
'prefix' => '', 'prefix' => '',
'suffix' => '', 'suffix' => '',
// Valid size property values include: 'tiny', 'small', 'medium', 'normal'
// and 'big'.
'size' => 'normal',
) + parent::defaultFieldSettings(); ) + parent::defaultFieldSettings();
} }
......
...@@ -143,11 +143,12 @@ function testNumberIntegerField() { ...@@ -143,11 +143,12 @@ function testNumberIntegerField() {
// Create a field with settings to validate. // Create a field with settings to validate.
$field_name = Unicode::strtolower($this->randomMachineName()); $field_name = Unicode::strtolower($this->randomMachineName());
entity_create('field_storage_config', array( $storage = entity_create('field_storage_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'integer', 'type' => 'integer',
))->save(); ));
$storage->save();
entity_create('field_config', array( entity_create('field_config', array(
'field_name' => $field_name, 'field_name' => $field_name,
...@@ -172,6 +173,22 @@ function testNumberIntegerField() { ...@@ -172,6 +173,22 @@ function testNumberIntegerField() {
)) ))
->save(); ->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. // Display creation form.
$this->drupalGet('entity_test/add'); $this->drupalGet('entity_test/add');
$this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
......
Supports Markdown
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