You are here

private function RouteSubscriber::setLoadLatestRevision in Lightning Core 8.5

Modifies an entity-aware route such that it can load the latest revision.

Parameters

string $route_name: The route name.

\Symfony\Component\Routing\RouteCollection $collection: The complete route collection containing the route to alter.

1 call to RouteSubscriber::setLoadLatestRevision()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 74

Class

RouteSubscriber
Dynamically alters various routes.

Namespace

Drupal\lightning_core\Routing

Code

private function setLoadLatestRevision($route_name, RouteCollection $collection) {
  $route = $collection
    ->get($route_name);
  if ($route) {
    $parameters = $route
      ->getOption('parameters');
    $parameters['entity']['load_latest_revision'] = TRUE;
    $route
      ->setOption('parameters', $parameters);
  }
}