protected function VariantRouteFilter::getRequestAttributes in Page Manager 8
Same name and namespace in other branches
- 8.4 src/Routing/VariantRouteFilter.php \Drupal\page_manager\Routing\VariantRouteFilter::getRequestAttributes()
Prepares the request attributes for use by the selection process.
This is be done because route filters run before request attributes are populated.
Parameters
\Symfony\Component\Routing\Route $route: The route.
string $name: The route name.
\Symfony\Component\HttpFoundation\Request $request: The current request.
Return value
array|false An array of request attributes or FALSE if any route enhancers fail.
1 call to VariantRouteFilter::getRequestAttributes()
- VariantRouteFilter::getVariantRouteName in src/
Routing/ VariantRouteFilter.php - Gets the route name of the first valid variant.
File
- src/
Routing/ VariantRouteFilter.php, line 219 - Contains \Drupal\page_manager\Routing\VariantRouteFilter.
Class
- VariantRouteFilter
- Filters variant routes.
Namespace
Drupal\page_manager\RoutingCode
protected function getRequestAttributes(Route $route, $name, Request $request) {
// Extract the raw attributes from the current path. This performs the same
// functionality as \Drupal\Core\Routing\UrlMatcher::finalMatch().
$path = $this->currentPath
->getPath($request);
$raw_attributes = RouteAttributes::extractRawAttributes($route, $name, $path);
$attributes = $request->attributes
->all();
$attributes = NestedArray::mergeDeep($attributes, $raw_attributes);
// Run the route enhancers on the raw attributes. This performs the same
// functionality as \Symfony\Cmf\Component\Routing\DynamicRouter::match().
foreach ($this
->getRouteEnhancers() as $enhancer) {
try {
$attributes = $enhancer
->enhance($attributes, $request);
} catch (\Exception $e) {
return FALSE;
}
}
return $attributes;
}