diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index 2ed3c24..5e1ca32 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -80,7 +80,7 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI * * @var string */ - public $type; + protected $type; /** * The name of the module that provides the field type. @@ -97,7 +97,7 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI * * @var array */ - protected $settings = array(); + protected $settings = []; /** * The field cardinality. diff --git a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php index ad99896..20d74b0 100644 --- a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php @@ -106,7 +106,7 @@ public function buildRow(EntityInterface $field_storage) { $row['data']['id'] = $field_storage->field_name; } - $field_type = $this->fieldTypes[$field_storage->type]; + $field_type = $this->fieldTypes[$field_storage->getType()]; $row['data']['type'] = t('@type (module: @module)', array('@type' => $field_type['label'], '@module' => $field_type['provider'])); $usage = array(); diff --git a/core/modules/field_ui/src/Tests/EntityDisplayTest.php b/core/modules/field_ui/src/Tests/EntityDisplayTest.php index 0db126a..f7daf05 100644 --- a/core/modules/field_ui/src/Tests/EntityDisplayTest.php +++ b/core/modules/field_ui/src/Tests/EntityDisplayTest.php @@ -168,7 +168,7 @@ public function testFieldComponent() { // Check that providing no options results in default values being used. $display->setComponent($field_name); - $field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->type); + $field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->getType()); $default_formatter = $field_type_info['default_formatter']; $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($default_formatter); $expected = array( diff --git a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php index b7f5032..18eb01b 100644 --- a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php +++ b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php @@ -69,7 +69,7 @@ public function testFieldComponent() { // Check that providing no options results in default values being used. $form_display->setComponent($field_name); - $field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->type); + $field_type_info = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field_storage->getType()); $default_widget = $field_type_info['default_widget']; $widget_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings($default_widget); $expected = array( diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 02ad43b..5a5c267 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -367,7 +367,7 @@ function image_entity_presave(EntityInterface $entity) { * Implements hook_ENTITY_TYPE_update() for 'field_storage_config'. */ function image_field_storage_config_update(FieldStorageConfigInterface $field_storage) { - if ($field_storage->type != 'image') { + if ($field_storage->getType() != 'image') { // Only act on image fields. return; } @@ -408,7 +408,7 @@ function image_field_storage_config_update(FieldStorageConfigInterface $field_st */ function image_field_config_update(FieldConfigInterface $field) { $field_storage = $field->getFieldStorageDefinition(); - if ($field_storage->type != 'image') { + if ($field_storage->getType() != 'image') { // Only act on image fields. return; } @@ -462,7 +462,7 @@ function image_field_storage_config_delete(FieldStorageConfigInterface $field) { */ function image_field_config_delete(FieldConfigInterface $field) { $field_storage = $field->getFieldStorageDefinition(); - if ($field_storage->type != 'image') { + if ($field_storage->getType() != 'image') { // Only act on image fields. return; } diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php index c621630..5482513 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldTest.php @@ -47,28 +47,28 @@ public function testFields() { /** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */ $field_storage = entity_load('field_storage_config', 'node.field_test'); $expected = array('max_length' => 255); - $this->assertEqual($field_storage->type, "text", t('Field type is @fieldtype. It should be text.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "text", t('Field type is @fieldtype. It should be text.', array('@fieldtype' => $field_storage->getType()))); $this->assertEqual($field_storage->status(), TRUE, "Status is TRUE"); $this->assertEqual($field_storage->getSettings(), $expected, "Field type text settings are correct"); // Integer field. $field_storage = entity_load('field_storage_config', 'node.field_test_two'); - $this->assertEqual($field_storage->type, "integer", t('Field type is @fieldtype. It should be integer.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "integer", t('Field type is @fieldtype. It should be integer.', array('@fieldtype' => $field_storage->getType()))); // Float field. $field_storage = entity_load('field_storage_config', 'node.field_test_three'); - $this->assertEqual($field_storage->type, "decimal", t('Field type is @fieldtype. It should be decimal.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "decimal", t('Field type is @fieldtype. It should be decimal.', array('@fieldtype' => $field_storage->getType()))); // Link field. $field_storage = entity_load('field_storage_config', 'node.field_test_link'); - $this->assertEqual($field_storage->type, "link", t('Field type is @fieldtype. It should be link.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "link", t('Field type is @fieldtype. It should be link.', array('@fieldtype' => $field_storage->getType()))); // File field. $field_storage = entity_load('field_storage_config', 'node.field_test_filefield'); - $this->assertEqual($field_storage->type, "file", t('Field type is @fieldtype. It should be file.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "file", t('Field type is @fieldtype. It should be file.', array('@fieldtype' => $field_storage->getType()))); $field_storage = entity_load('field_storage_config', 'node.field_test_imagefield'); - $this->assertEqual($field_storage->type, "image", t('Field type is @fieldtype. It should be image.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "image", t('Field type is @fieldtype. It should be image.', array('@fieldtype' => $field_storage->getType()))); $settings = $field_storage->getSettings(); $this->assertEqual($settings['target_type'], 'file'); $this->assertEqual($settings['uri_scheme'], 'public'); @@ -77,16 +77,16 @@ public function testFields() { // Phone field. $field_storage = entity_load('field_storage_config', 'node.field_test_phone'); - $this->assertEqual($field_storage->type, "telephone", t('Field type is @fieldtype. It should be telephone.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "telephone", t('Field type is @fieldtype. It should be telephone.', array('@fieldtype' => $field_storage->getType()))); // Date field. $field_storage = entity_load('field_storage_config', 'node.field_test_datetime'); - $this->assertEqual($field_storage->type, "datetime", t('Field type is @fieldtype. It should be datetime.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "datetime", t('Field type is @fieldtype. It should be datetime.', array('@fieldtype' => $field_storage->getType()))); $this->assertEqual($field_storage->status(), FALSE, "Status is FALSE"); // Decimal field with radio buttons. $field_storage = entity_load('field_storage_config', 'node.field_test_decimal_radio_buttons'); - $this->assertEqual($field_storage->type, "list_float", t('Field type is @fieldtype. It should be list_float.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "list_float", t('Field type is @fieldtype. It should be list_float.', array('@fieldtype' => $field_storage->getType()))); $this->assertNotNull($field_storage->getSetting('allowed_values')['1.2'], t('First allowed value key is set to 1.2')); $this->assertNotNull($field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value key is set to 2.1')); $this->assertEqual($field_storage->getSetting('allowed_values')['1.2'], '1.2', t('First allowed value is set to 1.2')); @@ -94,11 +94,11 @@ public function testFields() { // Float field with a single checkbox. $field_storage = entity_load('field_storage_config', 'node.field_test_float_single_checkbox'); - $this->assertEqual($field_storage->type, "boolean", t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "boolean", t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType()))); // Integer field with a select list. $field_storage = entity_load('field_storage_config', 'node.field_test_integer_selectlist'); - $this->assertEqual($field_storage->type, "list_integer", t('Field type is @fieldtype. It should be list_integer.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "list_integer", t('Field type is @fieldtype. It should be list_integer.', array('@fieldtype' => $field_storage->getType()))); $this->assertNotNull($field_storage->getSetting('allowed_values')['1234'], t('First allowed value key is set to 1234')); $this->assertNotNull($field_storage->getSetting('allowed_values')['2341'], t('Second allowed value key is set to 2341')); $this->assertNotNull($field_storage->getSetting('allowed_values')['3412'], t('Third allowed value key is set to 3412')); @@ -110,7 +110,7 @@ public function testFields() { // Text field with a single checkbox. $field_storage = entity_load('field_storage_config', 'node.field_test_text_single_checkbox'); - $this->assertEqual($field_storage->type, "boolean", t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->type))); + $this->assertEqual($field_storage->getType(), "boolean", t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType()))); } diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php index 24643ab..48d6cac 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php @@ -40,20 +40,20 @@ protected function setUp() { public function testUserProfileFields() { // Migrated a text field. $field_storage = entity_load('field_storage_config', 'user.profile_color'); - $this->assertEqual($field_storage->type, 'text', 'Field type is text.'); + $this->assertEqual($field_storage->getType(), 'text', 'Field type is text.'); $this->assertEqual($field_storage->getCardinality(), 1, 'Text field has correct cardinality'); // Migrated a textarea. $field_storage = entity_load('field_storage_config', 'user.profile_biography'); - $this->assertEqual($field_storage->type, 'text_long', 'Field type is text_long.'); + $this->assertEqual($field_storage->getType(), 'text_long', 'Field type is text_long.'); // Migrated checkbox field. $field_storage = entity_load('field_storage_config', 'user.profile_sell_address'); - $this->assertEqual($field_storage->type, 'boolean', 'Field type is boolean.'); + $this->assertEqual($field_storage->getType(), 'boolean', 'Field type is boolean.'); // Migrated selection field. $field_storage = entity_load('field_storage_config', 'user.profile_sold_to'); - $this->assertEqual($field_storage->type, 'list_string', 'Field type is list_string.'); + $this->assertEqual($field_storage->getType(), 'list_string', 'Field type is list_string.'); $settings = $field_storage->getSettings(); $this->assertEqual($settings['allowed_values'], array( 'Pill spammers' => 'Pill spammers', @@ -64,22 +64,22 @@ public function testUserProfileFields() { 'Faithful servant' => 'Faithful servant', 'Anonymous donor' => 'Anonymous donor', )); - $this->assertEqual($field_storage->type, 'list_string', 'Field type is list_string.'); + $this->assertEqual($field_storage->getType(), 'list_string', 'Field type is list_string.'); // Migrated list field. $field_storage = entity_load('field_storage_config', 'user.profile_bands'); - $this->assertEqual($field_storage->type, 'text', 'Field type is text.'); + $this->assertEqual($field_storage->getType(), 'text', 'Field type is text.'); $this->assertEqual($field_storage->getCardinality(), -1, 'List field has correct cardinality'); /* // Migrated URL field. $field_storage = entity_load('field_storage_config', 'user.profile_blog'); - $this->assertEqual($field_storage->type, 'link', 'Field type is link.'); + $this->assertEqual($field_storage->getType(), 'link', 'Field type is link.'); */ // Migrated date field. $field_storage = entity_load('field_storage_config', 'user.profile_birthdate'); - $this->assertEqual($field_storage->type, 'datetime', 'Field type is datetime.'); + $this->assertEqual($field_storage->getType(), 'datetime', 'Field type is datetime.'); $this->assertEqual($field_storage->getSetting('datetime_type'), 'date'); }