diff --git a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php index 440d240..a1958ff 100644 --- a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php +++ b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php @@ -247,7 +247,7 @@ protected function getCanonicalRoute(EntityTypeInterface $entity_type) { * The generated route, if available. */ protected function getUuidRoute(EntityTypeInterface $entity_type) { - if ($entity_type->getKey('uuid') && $entity_type->hasViewBuilderClass()) { + if ($entity_type->getKey('uuid') && $entity_type->hasViewBuilderClass() && $entity_type->hasLinkTemplate('uuid')) { $entity_type_id = $entity_type->id(); $route = new Route($entity_type->getLinkTemplate('uuid')); $route diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 529f6d7..a37627e 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -341,7 +341,7 @@ public static function fromUri($uri, $options = []) { protected static function fromEntityUri(array $uri_parts, array $options, $uri) { list($entity_type_id, $entity_id) = explode('/', $uri_parts['path'], 2); if ($uri_parts['scheme'] != 'entity' || $entity_id === '') { - throw new \InvalidArgumentException("The entity URI '$uri' is invalid. You must specify the entity id in the URL. e.g., entity:node/1 or entity:node/d44a0040-2844-4cca-b0b5-20c6c96c4d8c for loading the canonical path to node entity with id 1."); + throw new \InvalidArgumentException("The entity URI '$uri' is invalid. You must specify the entity id in the URL. e.g., entity:node/1 or entity:node/{uuid} for loading the canonical path to node entity with id 1."); } $route_name = "entity.$entity_type_id.canonical"; if (Uuid::isValid($entity_id)) { diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index ecd28ca..016cca7 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -8,7 +8,6 @@ use Drupal\Core\Menu\MenuLinkInterface; use Drupal\Core\Url; use Drupal\menu_link_content\Entity\MenuLinkContent; -use Drupal\node\Entity\NodeType; use Drupal\system\Entity\Menu; use Drupal\node\Entity\Node; diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 5745724..2f18d1d 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1672,7 +1672,7 @@ function system_update_8014() { /** * The simple presence of this update function clears cached entity definitions. */ -function system_update_8015() { +function system_update_8200() { // Many core entity-types now have a UUID link template and route. } diff --git a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php index b5af1c4..9644ed1 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php @@ -274,12 +274,18 @@ public function providerTestGetUuidRoute() { $entity_type2->hasViewBuilderClass()->willReturn(FALSE); $data['no_view_builder'] = [$entity_type2->reveal()]; - $entity_type3 = $this->getEntityType($entity_type2); + $entity_type3 = $this->getEntityType($entity_type2);; $entity_type3->hasViewBuilderClass()->willReturn(TRUE); - $entity_type3->id()->willReturn('the_entity_type_id'); - $entity_type3->getKey('uuid')->willReturn(TRUE); - $entity_type3->getLinkTemplate('uuid')->willReturn('/the_entity_type_id/{the_entity_type_id}'); - $entity_type3->isSubclassOf(FieldableEntityInterface::class)->willReturn(FALSE); + $entity_type3->hasLinkTemplate('uuid')->willReturn(FALSE); + $data['no_uuid_link_template'] = [$entity_type2->reveal()]; + + $entity_type4 = $this->getEntityType($entity_type2); + $entity_type4->hasViewBuilderClass()->willReturn(TRUE); + $entity_type4->id()->willReturn('the_entity_type_id'); + $entity_type4->getKey('uuid')->willReturn(TRUE); + $entity_type4->hasLinkTemplate('uuid')->willReturn(TRUE); + $entity_type4->getLinkTemplate('uuid')->willReturn('/the_entity_type_id/{the_entity_type_id}'); + $entity_type4->isSubclassOf(FieldableEntityInterface::class)->willReturn(FALSE); $route = (new Route('/the_entity_type_id/{the_entity_type_id}')) ->setDefaults([ '_entity_view' => 'the_entity_type_id.full', @@ -296,7 +302,7 @@ public function providerTestGetUuidRoute() { ], ], ]); - $data['has_uuid_route'] = [$entity_type3->reveal(), $route]; + $data['has_uuid_route'] = [$entity_type4->reveal(), $route]; return $data; }