public EntityRevisionRouteEnhancer::enhance(array $defaults, Request $request)
Update the defaults based on its own data and the request.
array $defaults the getRouteDefaults array.:
Request $request the Request instance.:
array the modified defaults. Each enhancer MUST return the $defaults but may add or remove values.
Overrides RouteEnhancerInterface::enhance
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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!Enhancer!EntityRevisionRouteEnhancer.php/function/EntityRevisionRouteEnhancer::enhance/8.1.x