diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php b/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php deleted file mode 100644 index 9f05831..0000000 --- a/core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php +++ /dev/null @@ -1,35 +0,0 @@ -getStorage('field_storage_config')->loadByProperties(array('type' => 'taxonomy_term_reference'))) { - return; - } - - // Update the field storage settings. - foreach ($field_storage_configs as $field_storage) { - // Since the usual workflow for field storages do not allow changing the - // field type, we have to work around it in this case. - $field_storage->original = $field_storage; - - $field_storage->settings['target_type'] = 'taxonomy_term'; - $field_storage->module = $field_storage->type = $field_storage->original->type = 'entity_reference'; - - $vocabulary_name = $field_storage->settings['allowed_values'][0]['vocabulary']; - unset($field_storage->settings['allowed_values']); - $field_storage->save(); - - // Update the field settings. - $field_name = $field_storage->getName(); - if (!$fields = \Drupal::entityManager()->getStorage('field_config')->loadByProperties(array('field_name' => $field_name))) { - continue; - } - - foreach ($fields as $field) { - $field->field_type = 'entity_reference'; - $field->settings['handler'] = 'default'; - $field->settings['handler_settings'] = array( - 'target_bundles' => array($vocabulary_name => $vocabulary_name), - // Enable auto-create. - 'auto_create' => TRUE, - ); - $field->save(); - - // Update entity view displays. - $properties = array( - 'targetEntityType' => $field->getTargetEntityTypeId(), - 'bundle' => $field->getTargetBundle() - ); - if ($view_displays = \Drupal::entityManager()->getStorage('entity_view_display')->loadByProperties($properties)) { - foreach ($view_displays as $view_display) { - if ($component = $view_display->getComponent($field_name)) { - $view_display->setComponent($field_name, array( - 'type' => 'entity_reference_label', - 'settings' => array( - 'link' => TRUE, - ), - ) + $component)->save(); - } - } - } - - // Update entity form displays. - $properties = array( - 'targetEntityType' => $field->getTargetEntityTypeId(), - 'bundle' => $field->getTargetBundle() - ); - if ($form_displays = \Drupal::entityManager()->getStorage('entity_form_display')->loadByProperties($properties)) { - foreach ($form_displays as $form_display) { - if ($component = $form_display->getComponent($field_name)) { - $form_display->setComponent($field_name, array( - 'type' => 'entity_reference_autocomplete_tags', - 'settings' => array( - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ), - ) + $component)->save(); - } - } - } - } - } -}