diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index 6b7de03..d607cec 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -1192,7 +1192,7 @@ public static function _fieldSqlSchema(FieldConfigInterface $field, array $schem // Define the entity ID schema based on the field definitions. $id_definition = $definitions[$entity_type->getKey('id')]; - if ($id_definition->getType() == 'integer') { + if ($id_definition->getTypeId() == 'integer') { $id_schema = array( 'type' => 'int', 'unsigned' => TRUE, @@ -1212,7 +1212,7 @@ public static function _fieldSqlSchema(FieldConfigInterface $field, array $schem // Define the revision ID schema, default to integer if there is no revision // ID. $revision_id_definition = $entity_type->hasKey('revision_id') ? $definitions[$entity_type->getKey('revision_id')] : NULL; - if (!$revision_id_definition || $revision_id_definition->getType() == 'integer') { + if (!$revision_id_definition || $revision_id_definition->getTypeId() == 'integer') { $revision_id_schema = array( 'type' => 'int', 'unsigned' => TRUE, diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 930b7ec..9a30d41 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -101,6 +101,9 @@ class EntityManager extends PluginManagerBase implements EntityManagerInterface /** * Static cache of storage field definitions per entity type. * + * Elements of the array: + * - $entity_type_id: \Drupal\Core\Field\FieldDefinition[] + * * @var array */ protected $storageFieldDefinitions; @@ -355,8 +358,8 @@ protected function buildBaseFieldDefinitions($entity_type_id) { $base_field_definitions = $class::baseFieldDefinitions($entity_type); $provider = $entity_type->getProvider(); foreach ($base_field_definitions as $definition) { - // @todo Remove this check one FieldDefinitionInterface exposes a proper - // provider setter. See https://drupal.org/node/2225961. + // @todo Remove this check once FieldDefinitionInterface exposes a proper + // provider setter. See https://drupal.org/node/2225961. if ($definition instanceof FieldDefinition) { $definition->setProvider($provider); } @@ -369,8 +372,8 @@ protected function buildBaseFieldDefinitions($entity_type_id) { // Ensure the provider key actually matches the name of the provider // defining the field. foreach ($module_definitions as $field_name => $definition) { - // @todo Remove this check one FieldDefinitionInterface exposes a - // proper provider setter. See https://drupal.org/node/2225961. + // @todo Remove this check once FieldDefinitionInterface exposes a + // proper provider setter. See https://drupal.org/node/2225961. if ($definition instanceof FieldDefinition) { $definition->setProvider($module); } @@ -452,8 +455,8 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $ $bundle_field_definitions = $class::bundleFieldDefinitions($entity_type, $bundle, $base_field_definitions); $provider = $entity_type->getProvider(); foreach ($bundle_field_definitions as $definition) { - // @todo Remove this check one FieldDefinitionInterface exposes a proper - // provider setter. See https://drupal.org/node/2225961. + // @todo Remove this check once FieldDefinitionInterface exposes a proper + // provider setter. See https://drupal.org/node/2225961. if ($definition instanceof FieldDefinition) { $definition->setProvider($provider); } @@ -466,8 +469,8 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $ // Ensure the provider key actually matches the name of the provider // defining the field. foreach ($module_definitions as $field_name => $definition) { - // @todo Remove this check one FieldDefinitionInterface exposes a - // proper provider setter. See https://drupal.org/node/2225961. + // @todo Remove this check once FieldDefinitionInterface exposes a + // proper provider setter. See https://drupal.org/node/2225961. if ($definition instanceof FieldDefinition) { $definition->setProvider($module); } @@ -532,8 +535,8 @@ protected function buildStorageFieldDefinitions($entity_type_id) { // Ensure the provider key actually matches the name of the provider // defining the field. foreach ($module_definitions as $field_name => $definition) { - // @todo Remove this check one FieldDefinitionInterface exposes a - // proper provider setter. See https://drupal.org/node/2225961. + // @todo Remove this check once FieldDefinitionInterface exposes a + // proper provider setter. See https://drupal.org/node/2225961. if ($definition instanceof FieldDefinition) { $definition->setProvider($module); } diff --git a/core/lib/Drupal/Core/Field/FieldDefinition.php b/core/lib/Drupal/Core/Field/FieldDefinition.php index 732c93f..ffce944 100644 --- a/core/lib/Drupal/Core/Field/FieldDefinition.php +++ b/core/lib/Drupal/Core/Field/FieldDefinition.php @@ -82,7 +82,7 @@ public static function create($type) { * @return $this */ public static function createFromFieldStorageDefinition(StorageFieldDefinitionInterface $definition) { - return static::create($definition->getType()) + return static::create($definition->getTypeId()) ->setCardinality($definition->getCardinality()) ->setConstraints($definition->getConstraints()) ->setCustomStorage($definition->hasCustomStorage()) @@ -131,7 +131,7 @@ public function setName($name) { /** * {@inheritdoc} */ - public function getType() { + public function getTypeId() { return $this->type; } @@ -474,7 +474,7 @@ public function setTargetEntityTypeId($entity_type_id) { public function getSchema() { if (!isset($this->schema)) { // Get the schema from the field item class. - $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($this->getType()); + $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($this->getTypeId()); $class = $definition['class']; $schema = $class::schema($this); // Fill in default values for optional entries. diff --git a/core/lib/Drupal/Core/Field/FormatterBase.php b/core/lib/Drupal/Core/Field/FormatterBase.php index 1b4287f..29fa270 100644 --- a/core/lib/Drupal/Core/Field/FormatterBase.php +++ b/core/lib/Drupal/Core/Field/FormatterBase.php @@ -84,7 +84,7 @@ public function view(FieldItemListInterface $items) { '#view_mode' => $this->viewMode, '#language' => $items->getLangcode(), '#field_name' => $field_name, - '#field_type' => $this->fieldDefinition->getType(), + '#field_type' => $this->fieldDefinition->getTypeId(), '#field_translatable' => $this->fieldDefinition->isTranslatable(), '#entity_type' => $entity_type, '#bundle' => $entity->bundle(), diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php index fa31ce7..62d8fe8 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php @@ -79,7 +79,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ); // Set the step for floating point and decimal numbers. - switch ($this->fieldDefinition->getType()) { + switch ($this->fieldDefinition->getTypeId()) { case 'decimal': $element['#step'] = pow(0.1, $field_settings['scale']); break; diff --git a/core/lib/Drupal/Core/Field/StorageFieldDefinitionInterface.php b/core/lib/Drupal/Core/Field/StorageFieldDefinitionInterface.php index 735d4b8..a330635 100644 --- a/core/lib/Drupal/Core/Field/StorageFieldDefinitionInterface.php +++ b/core/lib/Drupal/Core/Field/StorageFieldDefinitionInterface.php @@ -44,7 +44,7 @@ public function getName(); * * @see \Drupal\Core\Field\FieldTypePluginManagerInterface */ - public function getType(); + public function getTypeId(); /** * Returns the field settings. @@ -53,7 +53,7 @@ public function getType(); * For example, a text field can define a 'max_length' setting, and an image * field can define a 'alt_field_required' setting. * - * @return array + * @return mixed[] * An array of key/value pairs. */ public function getSettings(); @@ -119,7 +119,7 @@ public function getDescription(); * Possible values are positive integers or * FieldDefinitionInterface::CARDINALITY_UNLIMITED. * - * @return integer + * @return int * The field cardinality. */ public function getCardinality(); @@ -174,7 +174,7 @@ public function getPropertyDefinitions(); * while a link field might contain 'title' and 'url' properties, and a text * field might contain 'value', 'summary', and 'format' properties. * - * @return array + * @return string[] * The property names. */ public function getPropertyNames(); @@ -213,7 +213,7 @@ public function getTargetEntityTypeId(); * Note that this method returns an empty array for computed fields which have * no schema. * - * @return array + * @return array[] * The field schema, as an array of key/value pairs in the format returned * by hook_field_schema(): * - columns: An array of Schema API column specifications, keyed by column @@ -231,7 +231,7 @@ public function getSchema(); /** * Returns the field columns, as defined in the field schema. * - * @return array + * @return array[] * The array of field columns, keyed by column name, in the same format * returned by getSchema(). * @@ -244,10 +244,12 @@ public function getColumns(); * * See \Drupal\Core\TypedData\TypedDataManager::getConstraints() for details. * - * @return array + * @return array[] * An array of validation constraint definitions, keyed by constraint name. * Each constraint definition can be used for instantiating * \Symfony\Component\Validator\Constraint objects. + * + * @see \Symfony\Component\Validator\Constraint */ public function getConstraints(); @@ -262,6 +264,8 @@ public function getConstraints(); * @return array * A validation constraint definition which can be used for instantiating a * \Symfony\Component\Validator\Constraint object. + * + * @see \Symfony\Component\Validator\Constraint */ public function getConstraint($constraint_name); diff --git a/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php b/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php index dbf81c6..6ed9ba7 100644 --- a/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php +++ b/core/lib/Drupal/Core/Field/TypedData/FieldItemDataDefinition.php @@ -51,7 +51,7 @@ public static function createFromDataType($data_type) { * @return static */ public static function create($field_definition) { - $definition['type'] = 'field_item:' . $field_definition->getType(); + $definition['type'] = 'field_item:' . $field_definition->getTypeId(); $item_definition = new static($definition); $item_definition->fieldDefinition = $field_definition; return $item_definition; diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index 33ea5d8..c8dfde1 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -118,7 +118,7 @@ public function form(FieldItemListInterface $items, array &$form, array &$form_s '#parents' => array_merge($parents, array($field_name . '_wrapper')), '#attributes' => array( 'class' => array( - 'field-type-' . drupal_html_class($this->fieldDefinition->getType()), + 'field-type-' . drupal_html_class($this->fieldDefinition->getTypeId()), 'field-name-' . drupal_html_class($field_name), 'field-widget-' . drupal_html_class($this->getPluginId()), ), diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 9ee58fc..47d4409 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -193,7 +193,7 @@ function comment_count_unpublished() { * Implements hook_ENTITY_TYPE_insert() for 'field_instance_config'. */ function comment_field_instance_config_insert(FieldInstanceConfigInterface $instance) { - if ($instance->getType() == 'comment' && !$instance->isSyncing()) { + if ($instance->getTypeId() == 'comment' && !$instance->isSyncing()) { \Drupal::service('comment.manager')->addBodyField($instance->entity_type, $instance->getName()); } } @@ -202,7 +202,7 @@ function comment_field_instance_config_insert(FieldInstanceConfigInterface $inst * Implements hook_ENTITY_TYPE_create() for 'field_instance_config'. */ function comment_field_instance_config_create(FieldInstanceConfigInterface $instance) { - if ($instance->getType() == 'comment' && !$instance->isSyncing()) { + if ($instance->getTypeId() == 'comment' && !$instance->isSyncing()) { // Assign default values for the field instance. if (!isset($instance->default_value)) { $instance->default_value = array(); @@ -223,7 +223,7 @@ function comment_field_instance_config_create(FieldInstanceConfigInterface $inst * Implements hook_ENTITY_TYPE_update() for 'field_instance_config'. */ function comment_field_instance_config_update(FieldInstanceConfigInterface $instance) { - if ($instance->getType() == 'comment') { + if ($instance->getTypeId() == 'comment') { // Comment field settings also affects the rendering of *comment* entities, // not only the *commented* entities. \Drupal::entityManager()->getViewBuilder('comment')->resetCache(); @@ -234,7 +234,7 @@ function comment_field_instance_config_update(FieldInstanceConfigInterface $inst * Implements hook_ENTITY_TYPE_delete() for 'field_config'. */ function comment_field_config_delete(FieldConfigInterface $field) { - if ($field->getType() == 'comment') { + if ($field->getTypeId() == 'comment') { // Delete all fields and displays attached to the comment bundle. entity_invoke_bundle_hook('delete', 'comment', $field->entity_type . '__' . $field->getName()); } @@ -244,7 +244,7 @@ function comment_field_config_delete(FieldConfigInterface $field) { * Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'. */ function comment_field_instance_config_delete(FieldInstanceConfigInterface $instance) { - if ($instance->getType() == 'comment') { + if ($instance->getTypeId() == 'comment') { // Delete all comments that used by the entity bundle. $comments = db_query("SELECT cid FROM {comment} WHERE entity_type = :entity_type AND field_id = :field_id", array( ':entity_type' => $instance->getEntityTypeId(), diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index 96b8d3c..7122d9c 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -23,7 +23,7 @@ function content_translation_field_sync_widget(FieldDefinitionInterface $field) { $element = array(); - $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getType()); + $definition = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getTypeId()); $column_groups = $definition['column_groups']; if (!empty($column_groups) && count($column_groups) > 1) { $options = array(); diff --git a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php index 13bf441..99eedad 100644 --- a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php +++ b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php @@ -242,7 +242,7 @@ protected function simplify(array &$form, array &$form_state) { */ protected function getChangedFieldName(ContentEntityInterface $entity) { foreach ($entity->getFieldDefinitions() as $field) { - if ($field->getType() == 'changed') { + if ($field->getTypeId() == 'changed') { return $field->getName(); } } diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index dd1bfa0..b79985f 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -261,7 +261,7 @@ protected function init() { $this->hidden[$name] = TRUE; } elseif ($options) { - $this->content[$name] = $this->pluginManager->prepareConfiguration($definition->getType(), $options); + $this->content[$name] = $this->pluginManager->prepareConfiguration($definition->getTypeId(), $options); } // Note: (base) fields that do not specify display options are not // tracked in the display at all, in order to avoid cluttering the @@ -305,7 +305,7 @@ public function setComponent($name, array $options = array()) { // For a field, fill in default options. if ($field_definition = $this->getFieldDefinition($name)) { - $options = $this->pluginManager->prepareConfiguration($field_definition->getType(), $options); + $options = $this->pluginManager->prepareConfiguration($field_definition->getTypeId(), $options); } $this->content[$name] = $options; diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php index 2383ba6..f86393e 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php @@ -79,7 +79,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity $field_definition = $definitions[$field_name]; $access_controller = $this->entityManager()->getAccessController($entity_type); - if ($field_definition->getType() != 'entity_reference' || !$access_controller->fieldAccess('edit', $field_definition)) { + if ($field_definition->getTypeId() != 'entity_reference' || !$access_controller->fieldAccess('edit', $field_definition)) { throw new AccessDeniedHttpException(); } diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index c142163..f9d0f95 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -112,7 +112,7 @@ function field_views_field_default_views_data(FieldConfigInterface $field) { $data = array(); // Check the field type is available. - if (!\Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getType())) { + if (!\Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getTypeId())) { return $data; } // Check the field has instances. diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php index 7281d7e..e5de951 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php @@ -511,7 +511,7 @@ public function getName() { /** * {@inheritdoc} */ - public function getType() { + public function getTypeId() { return $this->type; } @@ -762,7 +762,7 @@ public function getMainPropertyName() { */ protected function getFieldItemClass() { $type_definition = \Drupal::typedDataManager() - ->getDefinition('field_item:' . $this->getType()); + ->getDefinition('field_item:' . $this->getTypeId()); return $type_definition['class']; } diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php index 46d8de1..7f8513b 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php @@ -490,7 +490,7 @@ public function getName() { /** * {@inheritdoc} */ - public function getType() { + public function getTypeId() { return $this->field->type; } @@ -719,7 +719,7 @@ public function isComputed() { public function getClass() { // Derive list class from the field type. $type_definition = \Drupal::service('plugin.manager.field.field_type') - ->getDefinition($this->getType()); + ->getDefinition($this->getTypeId()); return $type_definition['list_class']; } diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 808a31b..af17a99 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -523,7 +523,7 @@ function getInstance($entity_type, $bundle, $field_name) { */ public function prepareField(FieldConfigInterface $field) { // Make sure all expected field settings are present. - $field->settings += $this->fieldTypeManager->getDefaultSettings($field->getType()); + $field->settings += $this->fieldTypeManager->getDefaultSettings($field->getTypeId()); return $field; } @@ -539,7 +539,7 @@ public function prepareField(FieldConfigInterface $field) { */ public function prepareInstance(FieldInstanceConfigInterface $instance) { // Make sure all expected instance settings are present. - $instance->settings += $this->fieldTypeManager->getDefaultInstanceSettings($instance->getType()); + $instance->settings += $this->fieldTypeManager->getDefaultInstanceSettings($instance->getTypeId()); return $instance; } diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index 0f6ceb6..5143961 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -328,7 +328,7 @@ protected function defineOptions() { // defineOptions runs before init/construct, so no $this->field_info $field = field_info_field($this->definition['entity_type'], $this->definition['field_name']); - $field_type = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getType()); + $field_type = \Drupal::service('plugin.manager.field.field_type')->getDefinition($field->getTypeId()); $column_names = array_keys($field->getColumns()); $default_column = ''; // Try to determine a sensible default. @@ -400,7 +400,7 @@ public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); $field = $this->field_info; - $formatters = $this->formatterPluginManager->getOptions($field->getType()); + $formatters = $this->formatterPluginManager->getOptions($field->getTypeId()); $column_names = array_keys($field->getColumns()); // If this is a multiple value field, add its options. diff --git a/core/modules/field/tests/modules/field_test/field_test.field.inc b/core/modules/field/tests/modules/field_test/field_test.field.inc index 79b57a3..a7a988c 100644 --- a/core/modules/field/tests/modules/field_test/field_test.field.inc +++ b/core/modules/field/tests/modules/field_test/field_test.field.inc @@ -23,7 +23,7 @@ function field_test_field_widget_info_alter(&$info) { * Implements hook_field_config_update_forbid(). */ function field_test_field_config_update_forbid(FieldConfigInterface $field, FieldConfigInterface $prior_field) { - if ($field->getType() == 'test_field' && $field->getSetting('unchangeable') != $prior_field->getSetting('unchangeable')) { + if ($field->getTypeId() == 'test_field' && $field->getSetting('unchangeable') != $prior_field->getSetting('unchangeable')) { throw new FieldConfigUpdateForbiddenException("field_test 'unchangeable' setting cannot be changed'"); } } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index 2deca15..51215de 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -268,7 +268,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent '#region_callback' => array($this, 'getRowRegion'), '#js_settings' => array( 'rowHandler' => 'field', - 'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()), + 'defaultPlugin' => $this->getDefaultPlugin($field_definition->getTypeId()), ), 'human_name' => array( '#markup' => check_plain($label), @@ -305,7 +305,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent '#type' => 'select', '#title' => $this->t('Plugin for @title', array('@title' => $label)), '#title_display' => 'invisible', - '#options' => $this->getPluginOptions($field_definition->getType()), + '#options' => $this->getPluginOptions($field_definition->getTypeId()), '#default_value' => $display_options ? $display_options['type'] : 'hidden', '#parents' => array('fields', $field_name, 'type'), '#attributes' => array('class' => array('field-plugin-type')), diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php index 3739368..b473168 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldEditForm.php @@ -145,7 +145,7 @@ public function buildForm(array $form, array &$form_state, FieldInstanceConfigIn // Build the non-configurable field values. $form['field']['field_name'] = array('#type' => 'value', '#value' => $field->getName()); - $form['field']['type'] = array('#type' => 'value', '#value' => $field->getType()); + $form['field']['type'] = array('#type' => 'value', '#value' => $field->getTypeId()); $form['field']['module'] = array('#type' => 'value', '#value' => $field->module); // Add settings provided by the field module. The field module is diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 3843be9..0093e27 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1921,7 +1921,7 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag foreach ($return as $field_name => $data) { foreach (array_keys($data) as $entity_type_id) { $current_field = field_info_field($entity_type_id, $field_name); - if (($field_type && $current_field->getType() != $field_type) || ($field && $field->uuid() != $current_field->uuid())) { + if (($field_type && $current_field->getTypeId() != $field_type) || ($field && $field->uuid() != $current_field->uuid())) { unset($return[$field_name][$entity_type_id]); } } diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/destination/EntityContentBase.php index 4feee21..25030dc 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/destination/EntityContentBase.php @@ -84,7 +84,7 @@ public function import(Row $row, array $old_destination_id_values = array()) { } } foreach ($instances as $field_name => $instance) { - $field_type = $instance->getType(); + $field_type = $instance->getTypeId(); if ($this->migrateEntityFieldPluginManager->getDefinition($field_type)) { $destination_value = $this->migrateEntityFieldPluginManager->createInstance($field_type)->import($instance, $row->getDestinationProperty($field_name)); // @TODO: check for NULL return? Add an unset to $row? Maybe needed in diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php index 61c8c87..227b2d2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php @@ -355,9 +355,9 @@ protected function checkIntrospection($entity_type) { // Test getting metadata upfront. The entity types used for this test have // a default bundle that is the same as the entity type. $definitions = \Drupal::entityManager()->getFieldDefinitions($entity_type, $entity_type); - $this->assertEqual($definitions['name']->getType(), 'string', $entity_type .': Name field found.'); - $this->assertEqual($definitions['user_id']->getType(), 'entity_reference', $entity_type .': User field found.'); - $this->assertEqual($definitions['field_test_text']->getType(), 'text', $entity_type .': Test-text-field field found.'); + $this->assertEqual($definitions['name']->getTypeId(), 'string', $entity_type .': Name field found.'); + $this->assertEqual($definitions['user_id']->getTypeId(), 'entity_reference', $entity_type .': User field found.'); + $this->assertEqual($definitions['field_test_text']->getTypeId(), 'text', $entity_type .': Test-text-field field found.'); // Test deriving further metadata. $this->assertTrue($definitions['name'] instanceof FieldDefinitionInterface); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php index ab1db7d..cf96c30 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php @@ -110,7 +110,7 @@ public function autocomplete(Request $request, $entity_type, $field_name) { $tags_typed = $request->query->get('q'); // Make sure the field exists and is a taxonomy field. - if (!($field = $this->fieldInfo->getField($entity_type, $field_name)) || $field->getType() !== 'taxonomy_term_reference') { + if (!($field = $this->fieldInfo->getField($entity_type, $field_name)) || $field->getTypeId() !== 'taxonomy_term_reference') { // Error string. The JavaScript handler will realize this is not JSON and // will display it as debugging information. return new Response(t('Taxonomy field @field_name not found.', array('@field_name' => $field_name)), 403); diff --git a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php index 9637ccb..f901da2 100644 --- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php @@ -116,7 +116,7 @@ public function testFieldDescription() { */ public function testFieldType() { $definition = FieldDefinition::create($this->fieldType); - $this->assertEquals($this->fieldType, $definition->getType()); + $this->assertEquals($this->fieldType, $definition->getTypeId()); } /**