public function LazyRouteEnhancer::enhance in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Routing/LazyRouteEnhancer.php \Drupal\Core\Routing\LazyRouteEnhancer::enhance()
Update the defaults based on its own data and the request.
Parameters
array $defaults the getRouteDefaults array.:
Request $request the Request instance.:
Return value
array the modified defaults. Each enhancer MUST return the $defaults but may add or remove values.
Overrides RouteEnhancerInterface::enhance
File
- core/
lib/ Drupal/ Core/ Routing/ LazyRouteEnhancer.php, line 91 - Contains \Drupal\Core\Routing\LazyRouteEnhancer.
Class
- LazyRouteEnhancer
- A route enhancer which lazily loads route enhancers, depending on the route.
Namespace
Drupal\Core\RoutingCode
public function enhance(array $defaults, Request $request) {
/** @var \Symfony\Component\Routing\Route $route */
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
$enhancer_ids = $route
->getOption('_route_enhancers');
if (isset($enhancer_ids)) {
foreach ($enhancer_ids as $enhancer_id) {
$defaults = $this->container
->get($enhancer_id)
->enhance($defaults, $request);
}
}
return $defaults;
}