public EntityRevisionRouteEnhancer::enhance(array $defaults, Request $request)
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/Enhancer/EntityRevisionRouteEnhancer.php, line 31
Class
- EntityRevisionRouteEnhancer
- Adds _entity_revision to the request attributes, if possible.
Namespace
Drupal\Core\Routing\Enhancer
Code
public function enhance(array $defaults, Request $request) { /** @var \Symfony\Component\Routing\Route $route */ $route = $defaults[RouteObjectInterface::ROUTE_OBJECT]; $options = $route->getOptions(); if (isset($options['parameters'])) { foreach ($options['parameters'] as $name => $details) { if (!empty($details['type']) && strpos($details['type'], 'entity_revision:') !== FALSE) { $defaults['_entity_revision'] = $defaults[$name]; break; } } } return $defaults; }
Please login to continue.