diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php similarity index 92% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php index 2d08f5c..140770a 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DefaultNumberFormatter.php @@ -2,16 +2,16 @@ /** * @file - * Contains \Drupal\number\Plugin\field\formatter\DefaultNumberFormatter. + * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\DefaultNumberFormatter. */ -namespace Drupal\number\Plugin\Field\FieldFormatter; +namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; use Drupal\Core\Field\FormatterBase; use Drupal\Core\Field\FieldItemListInterface; /** - * Parent plugin for decimal and integer formatters + * Parent plugin for decimal and integer formatters. */ abstract class DefaultNumberFormatter extends FormatterBase { @@ -94,4 +94,5 @@ public function viewElements(FieldItemListInterface $items) { * The formatted number. */ abstract protected function numberFormat($number); + } diff --git a/core/modules/email/lib/Drupal/email/Plugin/Field/FieldFormatter/MailToFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/MailToFormatter.php similarity index 84% rename from core/modules/email/lib/Drupal/email/Plugin/Field/FieldFormatter/MailToFormatter.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/MailToFormatter.php index 609d46e..58f6c6b 100644 --- a/core/modules/email/lib/Drupal/email/Plugin/Field/FieldFormatter/MailToFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/MailToFormatter.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\email\Plugin\Field\FieldFormatter\MailToFormatter. + * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\MailToFormatter. */ -namespace Drupal\email\Plugin\Field\FieldFormatter; +namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; use Drupal\Core\Field\FormatterBase; use Drupal\Core\Field\FieldItemListInterface; diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php similarity index 90% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php index 3b6ac2b..cfc255b 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberDecimalFormatter.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\number\Plugin\field\formatter\NumberDecimalFormatter. + * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumberDecimalFormatter. */ -namespace Drupal\number\Plugin\Field\FieldFormatter; +namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; /** * Plugin implementation of the 'number_decimal' formatter. @@ -18,8 +18,8 @@ * id = "number_decimal", * label = @Translation("Default"), * field_types = { - * "number_decimal", - * "number_float" + * "decimal", + * "float" * }, * settings = { * "thousand_separator" = "", diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php similarity index 82% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php index 53ff874..89f3e4a 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberIntegerFormatter.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\number\Plugin\field\formatter\NumberIntegerFormatter. + * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumberIntegerFormatter. */ -namespace Drupal\number\Plugin\Field\FieldFormatter; +namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; /** * Plugin implementation of the 'number_integer' formatter. @@ -18,7 +18,7 @@ * id = "number_integer", * label = @Translation("Default"), * field_types = { - * "number_integer" + * "integer" * }, * settings = { * "thousand_separator" = "", diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php similarity index 75% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php index 46f093e..be5f2af 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumberUnformattedFormatter.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\number\Plugin\field\formatter\NumberUnformattedFormatter. + * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumberUnformattedFormatter. */ -namespace Drupal\number\Plugin\Field\FieldFormatter; +namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; use Drupal\Core\Field\FormatterBase; use Drupal\Core\Field\FieldItemListInterface; @@ -17,9 +17,9 @@ * id = "number_unformatted", * label = @Translation("Unformatted"), * field_types = { - * "number_integer", - * "number_decimal", - * "number_float" + * "integer", + * "decimal", + * "float" * } * ) */ diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/DecimalItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php similarity index 87% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/DecimalItem.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php index 305d8b4..ed503f9 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/DecimalItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php @@ -2,19 +2,19 @@ /** * @file - * Contains \Drupal\number\Plugin\Field\FieldType\DecimalItem. + * Contains \Drupal\Core\Field\Plugin\Field\FieldType\DecimalItem. */ -namespace Drupal\number\Plugin\Field\FieldType; +namespace Drupal\Core\Field\Plugin\Field\FieldType; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\TypedData\DataDefinition; /** - * Plugin implementation of the 'number_decimal' field type. + * Defines the 'decimal' entity field type. * * @FieldType( - * id = "number_decimal", + * id = "decimal", * label = @Translation("Number (decimal)"), * description = @Translation("This field stores a number in the database in a fixed decimal format."), * settings = { @@ -51,8 +51,8 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'numeric', - 'precision' => $field_definition->settings['precision'], - 'scale' => $field_definition->settings['scale'], + 'precision' => $field_definition->getSetting('precision'), + 'scale' => $field_definition->getSetting('scale'), 'not null' => FALSE ) ), diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php index 7c27fff..94e422b 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php @@ -18,8 +18,7 @@ * id = "email", * label = @Translation("E-mail"), * description = @Translation("An entity field containing an e-mail value."), - * configurable = FALSE, - * default_widget = "string", + * default_widget = "email_default", * default_formatter = "string" * ) */ diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php index c53f639..b4464ae 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php @@ -2,13 +2,12 @@ /** * @file - * Contains \Drupal\Core\Entity\Plugin\Field\FieldType\FloatItem. + * Contains \Drupal\Core\Field\Plugin\Field\FieldType\FloatItem. */ namespace Drupal\Core\Field\Plugin\Field\FieldType; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Field\FieldItemBase; use Drupal\Core\TypedData\DataDefinition; /** @@ -16,12 +15,19 @@ * * @FieldType( * id = "float", - * label = @Translation("Float"), - * description = @Translation("An entity field containing an float value."), - * configurable = FALSE + * label = @Translation("Number (float)"), + * description = @Translation("This field stores a number in the database in a floating point format."), + * instance_settings = { + * "min" = "", + * "max" = "", + * "prefix" = "", + * "suffix" = "" + * }, + * default_widget = "number", + * default_formatter = "number_decimal" * ) */ -class FloatItem extends FieldItemBase { +class FloatItem extends NumberItemBase { /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php index 0a7a8cf..0737de4 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/IntegerItem.php @@ -2,13 +2,12 @@ /** * @file - * Contains \Drupal\Core\Entity\Plugin\Field\FieldType\IntegerItem. + * Contains \Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem. */ namespace Drupal\Core\Field\Plugin\Field\FieldType; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Field\FieldItemBase; use Drupal\Core\TypedData\DataDefinition; /** @@ -16,12 +15,19 @@ * * @FieldType( * id = "integer", - * label = @Translation("Integer"), - * description = @Translation("An entity field containing an integer value."), - * configurable = FALSE + * label = @Translation("Number (integer)"), + * description = @Translation("This field stores a number in the database as an integer."), + * instance_settings = { + * "min" = "", + * "max" = "", + * "prefix" = "", + * "suffix" = "" + * }, + * default_widget = "number", + * default_formatter = "number_integer" * ) */ -class IntegerItem extends FieldItemBase { +class IntegerItem extends NumberItemBase { /** * {@inheritdoc} @@ -41,7 +47,7 @@ public static function schema(FieldDefinitionInterface $field_definition) { 'columns' => array( 'value' => array( 'type' => 'int', - 'not null' => TRUE, + 'not null' => FALSE, ), ), ); diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/NumberItemBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumberItemBase.php similarity index 96% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/NumberItemBase.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumberItemBase.php index a238861..04faa7e 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/NumberItemBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumberItemBase.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\number\Plugin\Field\FieldType\NumberItemBase. + * Contains \Drupal\Core\Field\Plugin\Field\FieldType\NumberItemBase. */ -namespace Drupal\number\Plugin\Field\FieldType; +namespace Drupal\Core\Field\Plugin\Field\FieldType; use Drupal\Core\Field\FieldItemBase; diff --git a/core/modules/email/lib/Drupal/email/Plugin/Field/FieldWidget/EmailDefaultWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php similarity index 92% rename from core/modules/email/lib/Drupal/email/Plugin/Field/FieldWidget/EmailDefaultWidget.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php index 62db527..c273bd8 100644 --- a/core/modules/email/lib/Drupal/email/Plugin/Field/FieldWidget/EmailDefaultWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\email\Plugin\Field\FieldWidget\EmailDefaultWidget. + * Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\EmailDefaultWidget. */ -namespace Drupal\email\Plugin\Field\FieldWidget; +namespace Drupal\Core\Field\Plugin\Field\FieldWidget; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldWidget/NumberWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php similarity index 91% rename from core/modules/number/lib/Drupal/number/Plugin/Field/FieldWidget/NumberWidget.php rename to core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php index 436e2cd..82c8d37 100644 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldWidget/NumberWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\number\Plugin\Field\FieldWidget\NumberWidget. + * Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\NumberWidget. */ -namespace Drupal\number\Plugin\Field\FieldWidget; +namespace Drupal\Core\Field\Plugin\Field\FieldWidget; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; @@ -18,9 +18,9 @@ * id = "number", * label = @Translation("Text field"), * field_types = { - * "number_integer", - * "number_decimal", - * "number_float" + * "integer", + * "decimal", + * "float" * }, * settings = { * "placeholder" = "" @@ -74,11 +74,11 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // Set the step for floating point and decimal numbers. switch ($this->fieldDefinition->getType()) { - case 'number_decimal': + case 'decimal': $element['#step'] = pow(0.1, $field_settings['scale']); break; - case 'number_float': + case 'float': $element['#step'] = 'any'; break; } diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php index 8d13286..524e89d 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringWidget.php @@ -17,8 +17,7 @@ * id = "string", * label = @Translation("String field"), * field_types = { - * "string", - * "email" + * "string" * }, * settings = { * "size" = "60", diff --git a/core/modules/email/config/schema/email.schema.yml b/core/modules/email/config/schema/email.schema.yml deleted file mode 100644 index 6e5a6c8..0000000 --- a/core/modules/email/config/schema/email.schema.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Schema for the configuration files of the Email module. - -field.email.settings: - type: sequence - label: 'E-mail settings' - sequence: - - type: string - -field.email.instance_settings: - type: sequence - label: 'E-mail settings' - sequence: - - type: string - label: 'Setting' - -field.email.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default' - mapping: - value: - type: email - label: 'Value' diff --git a/core/modules/email/email.info.yml b/core/modules/email/email.info.yml deleted file mode 100644 index 7a9293e..0000000 --- a/core/modules/email/email.info.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: E-mail -type: module -description: 'Defines a field type for e-mail addresses.' -package: Field types -version: VERSION -core: 8.x -dependencies: - - field diff --git a/core/modules/email/email.module b/core/modules/email/email.module deleted file mode 100644 index f15d84d..0000000 --- a/core/modules/email/email.module +++ /dev/null @@ -1,37 +0,0 @@ -' . t('About') . ''; - $output .= '

' . t('The E-mail module allows you to create fields that contain e-mail addresses. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the E-mail module.', array('@field' => url('admin/help/field'), '@field_ui' => url('admin/help/field_ui'), '@email_documentation' => 'https://drupal.org/documentation/modules/email')) . '

'; - $output .= '

' . t('Uses') . '

'; - $output .= '
'; - $output .= '
' . t('Managing and displaying email fields') . '
'; - $output .= '
' . t('The settings and the display of the email field can be configured separately. See the Field UI help for more information on how to manage fields and their display.', array('@field_ui' => url('admin/help/field_ui'))) . '
'; - $output .= '
' . t('Displaying e-mail addresses as links') . '
'; - $output .= '
' . t('E-mail addresses can be displayed as plain text or as links by choosing the appropriate display format.') . '
'; - $output .= '
' . t('Validating E-mail addresses') . '
'; - $output .= '
' . t('E-mail addresses are validated when the content is saved.') . '
'; - $output .= '
'; - return $output; - } -} - -/** - * Implements hook_field_info_alter(). - */ -function email_field_info_alter(&$info) { - $info['email']['configurable'] = TRUE; - $info['email']['default_widget'] = 'email_default'; - $info['email']['provider'] = 'email'; -} diff --git a/core/modules/field/config/schema/field.schema.yml b/core/modules/field/config/schema/field.schema.yml index 66a1444..8ac6a85 100644 --- a/core/modules/field/config/schema/field.schema.yml +++ b/core/modules/field/config/schema/field.schema.yml @@ -115,3 +115,197 @@ entity_form_display.field.hidden: sequence: - type: string +# Schema for the configuration files of the Email field type. + +field.email.settings: + type: sequence + label: 'E-mail settings' + sequence: + - type: string + +field.email.instance_settings: + type: sequence + label: 'E-mail settings' + sequence: + - type: string + label: 'Setting' + +field.email.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: email + label: 'Value' + +# Schema for configuration files of the number field types. + +field.number_integer.settings: + type: sequence + label: 'Integer settings' + sequence: + - type: string + label: 'setting' + +field.number_integer.instance_settings: + type: mapping + label: 'Integer' + mapping: + min: + type: integer + label: 'Minimum' + max: + type: integer + label: 'Maximum' + prefix: + type: string + label: 'Prefix' + suffix: + type: string + label: 'Suffix' + +field.number_integer.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default value' + mapping: + value: + type: integer + label: 'Value' + +field.number_decimal.settings: + type: mapping + label: 'Decimal settings' + mapping: + precision: + type: integer + label: 'Precision' + scale: + type: integer + label: 'Scale' + +field.number_decimal.instance_settings: + type: mapping + label: 'Decimal' + mapping: + min: + type: float + label: 'Minimum' + max: + type: float + label: 'Maximum' + prefix: + type: string + label: 'Prefix' + suffix: + type: string + label: 'Suffix' + +field.number_decimal.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default value' + mapping: + value: + type: float + label: 'Value' + +field.number_float.settings: + type: sequence + label: 'Float settings' + sequence: + - type: string + label: 'setting' + +field.number_float.instance_settings: + type: mapping + label: 'Float' + mapping: + min: + type: float + label: 'Minimum' + max: + type: float + label: 'Maximum' + prefix: + type: string + label: 'Prefix' + suffix: + type: string + label: 'Suffix' + +field.number_float.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default value' + mapping: + value: + type: float + label: 'Value' + +entity_view_display.field.number_decimal: + type: entity_field_view_display_base + label: 'Number decimal display format settings' + mapping: + settings: + type: mapping + label: 'Settings' + mapping: + thousand_separator: + type: string + label: 'Thousand marker' + decimal_separator: + type: string + label: 'Decimal marker' + scale: + type: integer + label: 'Scale' + prefix_suffix: + type: boolean + label: 'Display prefix and suffix.' + +entity_view_display.field.number_integer: + type: entity_field_view_display_base + label: 'Number interger display format settings' + mapping: + settings: + type: mapping + label: 'Settings' + mapping: + thousand_separator: + type: string + label: 'Thousand marker' + prefix_suffix: + type: boolean + label: 'Display prefix and suffix.' + +entity_view_display.field.number_unformatted: + type: entity_field_view_display_base + label: 'Number unformatted display format settings' + mapping: + settings: + type: sequence + label: 'Settings' + sequence: + - type: string + +entity_form_display.field.number: + type: entity_field_form_display_base + label: 'Number default display format settings' + mapping: + settings: + type: mapping + label: 'Settings' + mapping: + placeholder: + type: label + label: 'Placeholder' diff --git a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php index fab8603..93d5241 100644 --- a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\field\Tests\CrudTest. + * Contains \Drupal\field\Tests\CrudTest. */ namespace Drupal\field\Tests; @@ -17,7 +17,7 @@ class CrudTest extends FieldUnitTestBase { * * @var array */ - public static $modules = array('number'); + public static $modules = array(); public static function getInfo() { return array( @@ -364,13 +364,13 @@ function testUpdateFieldType() { $field_definition = array( 'name' => 'field_type', 'entity_type' => 'entity_test', - 'type' => 'number_decimal', + 'type' => 'decimal', ); $field = entity_create('field_config', $field_definition); $field->save(); try { - $field->type = 'number_integer'; + $field->type = 'integer'; $field->save(); $this->fail(t('Cannot update a field to a different type.')); } diff --git a/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/EmailFieldTest.php similarity index 93% rename from core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php rename to core/modules/field/lib/Drupal/field/Tests/EmailFieldTest.php index 9ae6eb0..bc9c4fe 100644 --- a/core/modules/email/lib/Drupal/email/Tests/EmailFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/EmailFieldTest.php @@ -2,12 +2,11 @@ /** * @file - * Definition of Drupal\email\Tests\EmailFieldTest. + * Contains \Drupal\field\Tests\EmailFieldTest. */ -namespace Drupal\email\Tests; +namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** @@ -20,7 +19,7 @@ class EmailFieldTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'entity_test', 'email', 'field_ui'); + public static $modules = array('node', 'entity_test', 'field_ui'); /** * A field to use in this test class. @@ -115,4 +114,5 @@ function testEmailField() { $this->drupalSetContent(drupal_render($content)); $this->assertLinkByHref('mailto:test@example.com'); } + } diff --git a/core/modules/email/lib/Drupal/email/Tests/EmailItemTest.php b/core/modules/field/lib/Drupal/field/Tests/EmailItemTest.php similarity index 95% rename from core/modules/email/lib/Drupal/email/Tests/EmailItemTest.php rename to core/modules/field/lib/Drupal/field/Tests/EmailItemTest.php index 7bbd89b..9c6d8a7 100644 --- a/core/modules/email/lib/Drupal/email/Tests/EmailItemTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/EmailItemTest.php @@ -2,14 +2,13 @@ /** * @file - * Contains \Drupal\email\Tests\EmailItemTest. + * Contains \Drupal\field\Tests\EmailItemTest. */ -namespace Drupal\email\Tests; +namespace Drupal\field\Tests; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; -use Drupal\field\Tests\FieldUnitTestBase; /** * Tests the new entity API for the email field type. diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldHelpTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldHelpTest.php index 074a009..0f976e0 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldHelpTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldHelpTest.php @@ -55,15 +55,15 @@ public function testFieldHelp() { $this->drupalGet('admin/help/field'); // Enable the Options, E-mail and Field API Test modules. - \Drupal::moduleHandler()->install(array('options', 'email', 'field_test')); + \Drupal::moduleHandler()->install(array('options', 'field_test')); \Drupal::service('plugin.manager.field.widget')->clearCachedDefinitions(); \Drupal::service('plugin.manager.field.field_type')->clearCachedDefinitions(); $this->drupalGet('admin/help/field'); $this->assertLink('Options', 0, 'Options module is listed on the Field help page.'); - $this->assertLink('E-mail', 0, 'E-mail module is listed on the Field help page.'); $this->assertText('Field API Test', 'Modules with field types that do not implement hook_help are listed.'); $this->assertNoLink('Field API Test', 'Modules with field types that do not implement hook_help are not linked.'); $this->assertNoLink('Link', 'Modules that have not been installed, are not listed.'); } + } diff --git a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/NumberFieldTest.php similarity index 96% rename from core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php rename to core/modules/field/lib/Drupal/field/Tests/NumberFieldTest.php index 2f5552b..dba784a 100644 --- a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/NumberFieldTest.php @@ -2,15 +2,15 @@ /** * @file - * Definition of Drupal\number\NumberFieldTest. + * Contains \Drupal\field\Tests\NumberFieldTest. */ -namespace Drupal\number\Tests; +namespace Drupal\field\Tests; use Drupal\simpletest\WebTestBase; /** - * Tests for number field types. + * Tests for numeric field types. */ class NumberFieldTest extends WebTestBase { @@ -19,7 +19,7 @@ class NumberFieldTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'entity_test', 'number', 'field_ui'); + public static $modules = array('node', 'entity_test', 'field_ui'); /** * A field to use in this class. @@ -44,8 +44,8 @@ class NumberFieldTest extends WebTestBase { public static function getInfo() { return array( - 'name' => 'Number field', - 'description' => 'Test the creation of number fields.', + 'name' => 'Numeric fields', + 'description' => 'Test the creation of numeric fields.', 'group' => 'Field types' ); } @@ -58,7 +58,7 @@ function setUp() { } /** - * Test number_decimal field. + * Test decimal field. */ function testNumberDecimalField() { // Create a field with settings to validate. @@ -66,7 +66,7 @@ function testNumberDecimalField() { entity_create('field_config', array( 'name' => $field_name, 'entity_type' => 'entity_test', - 'type' => 'number_decimal', + 'type' => 'decimal', 'settings' => array( 'precision' => 8, 'scale' => 4, 'decimal_separator' => '.', ) @@ -147,7 +147,7 @@ function testNumberDecimalField() { } /** - * Test number_integer field. + * Test integer field. */ function testNumberIntegerField() { $minimum = rand(-4000, -2000); @@ -158,7 +158,7 @@ function testNumberIntegerField() { entity_create('field_config', array( 'name' => $field_name, 'entity_type' => 'entity_test', - 'type' => 'number_integer', + 'type' => 'integer', ))->save(); entity_create('field_instance_config', array( @@ -254,7 +254,7 @@ function testNumberIntegerField() { } /** - * Test number_float field. + * Test float field. */ function testNumberFloatField() { // Create a field with settings to validate. @@ -262,7 +262,7 @@ function testNumberFloatField() { entity_create('field_config', array( 'name' => $field_name, 'entity_type' => 'entity_test', - 'type' => 'number_float', + 'type' => 'float', ))->save(); entity_create('field_instance_config', array( @@ -361,13 +361,13 @@ function testNumberFormatter() { entity_create('field_config', array( 'name' => $float_field, 'entity_type' => 'node', - 'type' => 'number_float', + 'type' => 'float', ))->save(); entity_create('field_config', array( 'name' => $integer_field, 'entity_type' => 'node', - 'type' => 'number_integer', + 'type' => 'integer', ))->save(); entity_create('field_instance_config', array( @@ -475,4 +475,5 @@ function testNumberFormatter() { $integer_formatted = number_format($random_integer, 0, '', $thousand_separator); $this->assertRaw($integer_formatted, 'Random integer formatted'); } + } diff --git a/core/modules/number/lib/Drupal/number/Tests/NumberItemTest.php b/core/modules/field/lib/Drupal/field/Tests/NumberItemTest.php similarity index 94% rename from core/modules/number/lib/Drupal/number/Tests/NumberItemTest.php rename to core/modules/field/lib/Drupal/field/Tests/NumberItemTest.php index 5122028..d6c45fd 100644 --- a/core/modules/number/lib/Drupal/number/Tests/NumberItemTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/NumberItemTest.php @@ -2,14 +2,13 @@ /** * @file - * Contains \Drupal\number\Tests\NumberItemTest. + * Contains \Drupal\field\Tests\NumberItemTest. */ -namespace Drupal\number\Tests; +namespace Drupal\field\Tests; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; -use Drupal\field\Tests\FieldUnitTestBase; /** * Tests the new entity API for the number field type. @@ -21,7 +20,7 @@ class NumberItemTest extends FieldUnitTestBase { * * @var array */ - public static $modules = array('number'); + public static $modules = array(); public static function getInfo() { return array( @@ -39,7 +38,7 @@ public function setUp() { entity_create('field_config', array( 'name' => 'field_' . $type, 'entity_type' => 'entity_test', - 'type' => 'number_' . $type, + 'type' => $type, ))->save(); entity_create('field_instance_config', array( 'entity_type' => 'entity_test', diff --git a/core/modules/number/config/schema/number.schema.yml b/core/modules/number/config/schema/number.schema.yml deleted file mode 100644 index dd175ce..0000000 --- a/core/modules/number/config/schema/number.schema.yml +++ /dev/null @@ -1,168 +0,0 @@ -# Schema for configuration files of the number module. - -field.number_integer.settings: - type: sequence - label: 'Integer settings' - sequence: - - type: string - label: 'setting' - -field.number_integer.instance_settings: - type: mapping - label: 'Integer' - mapping: - min: - type: integer - label: 'Minimum' - max: - type: integer - label: 'Maximum' - prefix: - type: string - label: 'Prefix' - suffix: - type: string - label: 'Suffix' - -field.number_integer.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default value' - mapping: - value: - type: integer - label: 'Value' - -field.number_decimal.settings: - type: mapping - label: 'Decimal settings' - mapping: - precision: - type: integer - label: 'Precision' - scale: - type: integer - label: 'Scale' - -field.number_decimal.instance_settings: - type: mapping - label: 'Decimal' - mapping: - min: - type: float - label: 'Minimum' - max: - type: float - label: 'Maximum' - prefix: - type: string - label: 'Prefix' - suffix: - type: string - label: 'Suffix' - -field.number_decimal.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default value' - mapping: - value: - type: float - label: 'Value' - -field.number_float.settings: - type: sequence - label: 'Float settings' - sequence: - - type: string - label: 'setting' - -field.number_float.instance_settings: - type: mapping - label: 'Float' - mapping: - min: - type: float - label: 'Minimum' - max: - type: float - label: 'Maximum' - prefix: - type: string - label: 'Prefix' - suffix: - type: string - label: 'Suffix' - -field.number_float.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default value' - mapping: - value: - type: float - label: 'Value' - -entity_view_display.field.number_decimal: - type: entity_field_view_display_base - label: 'Number decimal display format settings' - mapping: - settings: - type: mapping - label: 'Settings' - mapping: - thousand_separator: - type: string - label: 'Thousand marker' - decimal_separator: - type: string - label: 'Decimal marker' - scale: - type: integer - label: 'Scale' - prefix_suffix: - type: boolean - label: 'Display prefix and suffix.' - -entity_view_display.field.number_integer: - type: entity_field_view_display_base - label: 'Number interger display format settings' - mapping: - settings: - type: mapping - label: 'Settings' - mapping: - thousand_separator: - type: string - label: 'Thousand marker' - prefix_suffix: - type: boolean - label: 'Display prefix and suffix.' - -entity_view_display.field.number_unformatted: - type: entity_field_view_display_base - label: 'Number unformatted display format settings' - mapping: - settings: - type: sequence - label: 'Settings' - sequence: - - type: string - -entity_form_display.field.number: - type: entity_field_form_display_base - label: 'Number default display format settings' - mapping: - settings: - type: mapping - label: 'Settings' - mapping: - placeholder: - type: label - label: 'Placeholder' diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/FloatItem.php b/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/FloatItem.php deleted file mode 100644 index 9e545c5..0000000 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/FloatItem.php +++ /dev/null @@ -1,56 +0,0 @@ -setLabel(t('Float value')); - - return $properties; - } - - /** - * {@inheritdoc} - */ - public static function schema(FieldDefinitionInterface $field_definition) { - return array( - 'columns' => array( - 'value' => array( - 'type' => 'float', - 'not null' => FALSE, - ), - ), - ); - } - -} diff --git a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/IntegerItem.php b/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/IntegerItem.php deleted file mode 100644 index e9eecde..0000000 --- a/core/modules/number/lib/Drupal/number/Plugin/Field/FieldType/IntegerItem.php +++ /dev/null @@ -1,56 +0,0 @@ -setLabel(t('Integer value')); - - return $properties; - } - - /** - * {@inheritdoc} - */ - public static function schema(FieldDefinitionInterface $field_definition) { - return array( - 'columns' => array( - 'value' => array( - 'type' => 'int', - 'not null' => FALSE, - ), - ), - ); - } - -} diff --git a/core/modules/number/number.info.yml b/core/modules/number/number.info.yml deleted file mode 100644 index 21a37a7..0000000 --- a/core/modules/number/number.info.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Number -type: module -description: 'Defines numeric field types.' -package: Field types -version: VERSION -core: 8.x -dependencies: - - field diff --git a/core/modules/number/number.module b/core/modules/number/number.module deleted file mode 100644 index abe2b45..0000000 --- a/core/modules/number/number.module +++ /dev/null @@ -1,26 +0,0 @@ -' . t('About') . ''; - $output .= '

' . t('The Number module allows you to create fields that contain various types of numeric data. See the Field module help and the Field UI help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the Number module.', array('!field' => \Drupal::url('help.page', array('name' => 'field')), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')), '!number_do' => 'https://drupal.org/documentation/modules/number')) . '

'; - $output .= '

' . t('Uses') . '

'; - $output .= '
'; - $output .= '
' . t('Managing and displaying number fields') . '
'; - $output .= '
' . t('The settings and the display of the number fields can be configured separately. See the Field UI help for more information on how to manage fields and their display.', array('!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '
'; - $output .= '
' . t('Choosing number field type') . '
'; - $output .= '
' . t('When you add a number field you can choose from three types: decimal, float, or integer. The decimal number field type allows users to enter exact decimal values. The float number field type allows users to enter approximate decimal values. The integer number field type allows users to enter whole numbers, such as years (for example, 2012) or values (for example, 1, 2, 5, 305). It does not allow decimals.') . '
'; - $output .= '
'; - return $output; - } -} diff --git a/core/modules/options/options.info.yml b/core/modules/options/options.info.yml index 1d35ece..60e6043 100644 --- a/core/modules/options/options.info.yml +++ b/core/modules/options/options.info.yml @@ -7,4 +7,3 @@ core: 8.x dependencies: - field - text - - number