diff --git a/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php index 7c25539..071647a 100644 --- a/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php @@ -62,7 +62,7 @@ public function onRoutingRouteAlterSetLatestRevision(RouteBuildEvent $event) { } $parameters = $route->getOption('parameters') ?: []; foreach ($parameters as &$parameter) { - $parameter['_load_latest_revision'] = TRUE; + $parameter['load_latest_revision'] = TRUE; } $route->setOption('parameters', $parameters); } diff --git a/core/lib/Drupal/Core/ParamConverter/EntityConverter.php b/core/lib/Drupal/Core/ParamConverter/EntityConverter.php index ef1b19e..5478de8 100644 --- a/core/lib/Drupal/Core/ParamConverter/EntityConverter.php +++ b/core/lib/Drupal/Core/ParamConverter/EntityConverter.php @@ -4,9 +4,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\TypedData\TranslatableInterface; -use Drupal\node\Entity\Node; use Symfony\Component\Routing\Route; /** @@ -66,7 +64,7 @@ public function convert($value, $definition, $name, array $defaults) { $entity = $storage->load($value); // If the entity type is revisionable, load the latest revision. - if ($entity instanceof EntityInterface && !empty($definition['_load_latest_revision']) && $entity->getEntityType()->isRevisionable()) { + if ($entity instanceof EntityInterface && !empty($definition['load_latest_revision']) && $entity->getEntityType()->isRevisionable()) { // @todo, replace this with query with a standardised way of getting the // latest revision in https://www.drupal.org/node/2784201. $entity_revisions = $storage diff --git a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php index 8eff20a..9f14d44 100644 --- a/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php +++ b/core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php @@ -7,7 +7,7 @@ use Drupal\language\Entity\ConfigurableLanguage; /** - * Test the entity converter when the _load_latest_revision flag is set. + * Test the entity converter when the "load_latest_revision" flag is set. * * @group ParamConverter * @coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter @@ -53,7 +53,7 @@ protected function setUp() { */ public function testNoEntity() { $converted = $this->converter->convert(1, [ - '_load_latest_revision' => TRUE, + 'load_latest_revision' => TRUE, 'type' => 'entity:entity_test_mulrev', ], 'foo', []); $this->assertEquals(NULL, $converted); @@ -67,7 +67,7 @@ public function testEntityNoPendingRevision() { $entity->save(); $converted = $this->converter->convert(1, [ - '_load_latest_revision' => TRUE, + 'load_latest_revision' => TRUE, 'type' => 'entity:entity_test_mulrev', ], 'foo', []); $this->assertEquals($entity->getLoadedRevisionId(), $converted->getLoadedRevisionId()); @@ -85,7 +85,7 @@ public function testEntityWithPendingRevision() { $entity->save(); $converted = $this->converter->convert(1, [ - '_load_latest_revision' => TRUE, + 'load_latest_revision' => TRUE, 'type' => 'entity:entity_test_mulrev', ], 'foo', []); @@ -115,7 +115,7 @@ public function testWithTranslatedPendingRevision() { // The converter will load the latest revision in the correct language. $converted = $this->converter->convert(1, [ - '_load_latest_revision' => TRUE, + 'load_latest_revision' => TRUE, 'type' => 'entity:entity_test_mulrev', ], 'foo', []); $this->assertEquals('de', $converted->language()->getId());