diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index ad2c98c..a816729 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -72,10 +72,9 @@ protected static function getUriAsDisplayableString($uri) { elseif ($scheme === 'entity') { list($entity_type, $entity_id) = explode('/', substr($uri, 7), 2); // Show the 'entity:' URI as the entity autocomplete would. - $entity_manager = \Drupal::entityManager(); // @todo Support entity types other than 'node'. Will be fixed in // https://www.drupal.org/node/2423093. - if ($entity_type == 'node' && $entity = \Drupal::entityManager()->getStorage($entity_type)->load($entity_id)) { + if ($entity_type == 'node' && $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id)) { $displayable_string = EntityAutocomplete::getEntityLabels(array($entity)); } } diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php index e85ad53..046de5a 100644 --- a/core/modules/link/src/Tests/LinkFieldTest.php +++ b/core/modules/link/src/Tests/LinkFieldTest.php @@ -96,10 +96,7 @@ function testURLValidation() { $node = $this->drupalCreateNode(); // Create an entity with restricted view access. - $entity_test_no_label_access = EntityTest::create([ - 'name' => 'forbid_access', - ]); - $entity_test_no_label_access->save(); + $restricted_node = $this->drupalCreateNode(['status' => NODE_NOT_PUBLISHED]); // Define some valid URLs (keys are the entered values, values are the // strings displayed to the user). @@ -134,7 +131,7 @@ function testURLValidation() { // Entity URI displayed as ER autocomplete value when displayed in a form. 'entity:node/1' => $node->label() . ' (1)', // URI for an entity that exists, but is not accessible by the user. - 'entity:entity_test/' . $entity_test_no_label_access->id() => '- Restricted access - (' . $entity_test_no_label_access->id() . ')', + 'entity:node/' . $restricted_node->id() => '- Restricted access - (' . $restricted_node->id() . ')', // URI for an entity that doesn't exist, but with a valid ID. 'entity:user/999999' => 'entity:user/999999', );