You are here

protected function Router::applyRouteEnhancers in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::applyRouteEnhancers()
  2. 10 core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::applyRouteEnhancers()

Apply the route enhancers to the defaults, according to priorities.

Parameters

array $defaults: The defaults coming from the final matched route.

\Symfony\Component\HttpFoundation\Request $request: The request.

Return value

array The request attributes after applying the enhancers. This might consist raw values from the URL but also upcasted values, like entity objects, from route enhancers.

1 call to Router::applyRouteEnhancers()
Router::matchRequest in core/lib/Drupal/Core/Routing/Router.php
Tries to match a request with a set of routes.

File

core/lib/Drupal/Core/Routing/Router.php, line 255

Class

Router
Router implementation in Drupal.

Namespace

Drupal\Core\Routing

Code

protected function applyRouteEnhancers($defaults, Request $request) {
  foreach ($this->enhancers as $enhancer) {
    if ($enhancer instanceof RouteEnhancerInterface && !$enhancer
      ->applies($defaults[RouteObjectInterface::ROUTE_OBJECT])) {
      continue;
    }
    $defaults = $enhancer
      ->enhance($defaults, $request);
  }
  return $defaults;
}