diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index 0b4121d..5c7462b 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -134,7 +134,7 @@ function testFieldPrepare() { // Check that all expected settings are in place. $field_type = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_definition['type']); - $this->assertEqual($field->settings, $field_type['settings'], 'All expected default field settings are present.'); + $this->assertEqual($field->settings, $field_type['class']::settings(), 'All expected default field settings are present.'); } /** @@ -168,7 +168,7 @@ function testInstancePrepare() { // Check that all expected instance settings are in place. $field_type = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_definition['type']); - $this->assertEqual($instance->settings, $field_type['instance_settings'] , 'All expected instance settings are present.'); + $this->assertEqual($instance->settings, $field_type['class']::instanceSettings() , 'All expected instance settings are present.'); } /** @@ -292,8 +292,8 @@ function testSettingsInfo() { $info = $this->getExpectedFieldTypeDefinition(); foreach ($info as $type => $data) { $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); - $this->assertIdentical($field_type_manager->getDefaultSettings($type), $data['settings'], format_string("field settings service returns %type's field settings", array('%type' => $type))); - $this->assertIdentical($field_type_manager->getDefaultInstanceSettings($type), $data['instance_settings'], format_string("field instance settings service returns %type's field instance settings", array('%type' => $type))); + $this->assertIdentical($field_type_manager->getDefaultSettings($type), $data['class']::settings(), format_string("field settings service returns %type's field settings", array('%type' => $type))); + $this->assertIdentical($field_type_manager->getDefaultInstanceSettings($type), $data['class']::instanceSettings(), format_string("field instance settings service returns %type's field instance settings", array('%type' => $type))); } } @@ -341,15 +341,6 @@ protected function getExpectedFieldTypeDefinition() { 'test_field' => array( 'label' => t('Test field'), 'description' => t('Dummy field type used for tests.'), - 'settings' => array( - 'test_field_setting' => 'dummy test string', - 'changeable' => 'a changeable field setting', - 'unchangeable' => 'an unchangeable field setting', - ), - 'instance_settings' => array( - 'test_instance_setting' => 'dummy test string', - 'test_cached_data' => FALSE, - ), 'default_widget' => 'test_field_widget', 'default_formatter' => 'field_test_default', 'class' => 'Drupal\field_test\Plugin\Field\FieldType\TestItem', @@ -357,10 +348,6 @@ protected function getExpectedFieldTypeDefinition() { 'shape' => array( 'label' => t('Shape'), 'description' => t('Another dummy field type.'), - 'settings' => array( - 'foreign_key_name' => 'shape', - ), - 'instance_settings' => array(), 'default_widget' => 'test_field_widget', 'default_formatter' => 'field_test_default', 'class' => 'Drupal\field_test\Plugin\Field\FieldType\ShapeItem', @@ -369,8 +356,6 @@ protected function getExpectedFieldTypeDefinition() { 'no_ui' => TRUE, 'label' => t('Hidden from UI test field'), 'description' => t('Dummy hidden field type used for tests.'), - 'settings' => array(), - 'instance_settings' => array(), 'default_widget' => 'test_field_widget', 'default_formatter' => 'field_test_default', 'class' => 'Drupal\field_test\Plugin\Field\FieldType\HiddenTestItem', diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php index 1f73528..5654e7e 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php @@ -84,7 +84,7 @@ function testCreateFieldInstance() { $this->assertIdentical($config['description'], '', 'Description defaults to empty string.'); // Check that default settings are set. - $this->assertEqual($config['settings'], $field_type['instance_settings'] , 'Default instance settings have been written.'); + $this->assertEqual($config['settings'], $field_type['class']::instanceSettings() , 'Default instance settings have been written.'); // Guarantee that the field/bundle combination is unique. try { diff --git a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListBooleanItem.php b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListBooleanItem.php index a884a53..38ab4d8 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListBooleanItem.php +++ b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListBooleanItem.php @@ -19,7 +19,7 @@ * label = @Translation("Boolean"), * description = @Translation("This field stores simple on/off or yes/no options."), * default_widget = "options_buttons", - * default_formatter = "list_default" + * default_formatter = "list_default", * ) */ class ListBooleanItem extends ListItemBase { diff --git a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListFloatItem.php b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListFloatItem.php index 66d59a6..84d2489 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListFloatItem.php +++ b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListFloatItem.php @@ -19,7 +19,7 @@ * label = @Translation("List (float)"), * description = @Translation("This field stores float values from a list of allowed 'value => label' pairs, i.e. 'Fraction': 0 => 0, .25 => 1/4, .75 => 3/4, 1 => 1."), * default_widget = "options_select", - * default_formatter = "list_default" + * default_formatter = "list_default", * ) */ class ListFloatItem extends ListItemBase { diff --git a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListIntegerItem.php b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListIntegerItem.php index 5b963c6..ce1b744 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListIntegerItem.php +++ b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListIntegerItem.php @@ -19,7 +19,7 @@ * label = @Translation("List (integer)"), * description = @Translation("This field stores integer values from a list of allowed 'value => label' pairs, i.e. 'Lifetime in days': 1 => 1 day, 7 => 1 week, 31 => 1 month."), * default_widget = "options_select", - * default_formatter = "list_default" + * default_formatter = "list_default", * ) */ class ListIntegerItem extends ListItemBase { diff --git a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListTextItem.php b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListTextItem.php index 11757d2..6e0140b 100644 --- a/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListTextItem.php +++ b/core/modules/options/lib/Drupal/options/Plugin/Field/FieldType/ListTextItem.php @@ -20,10 +20,6 @@ * description = @Translation("This field stores text values from a list of allowed 'value => label' pairs, i.e. 'US States': IL => Illinois, IA => Iowa, IN => Indiana."), * default_widget = "options_select", * default_formatter = "list_default", - * settings = { - * "allowed_values" = { }, - * "allowed_values_function" = "" - * } * ) */ class ListTextItem extends ListItemBase {