protected function EasyBreadcrumbBuilder::setRouteContextFromRouteMatch in Easy Breadcrumb 8
Same name and namespace in other branches
- 2.x src/EasyBreadcrumbBuilder.php \Drupal\easy_breadcrumb\EasyBreadcrumbBuilder::setRouteContextFromRouteMatch()
Set request context from passed in $route_match if route is available.
Parameters
Drupal\Core\Routing\RouteMatchInterface $route_match: The route match for the breadcrumb.
1 call to EasyBreadcrumbBuilder::setRouteContextFromRouteMatch()
- EasyBreadcrumbBuilder::build in src/
EasyBreadcrumbBuilder.php - Builds the breadcrumb.
File
- src/
EasyBreadcrumbBuilder.php, line 638
Class
- EasyBreadcrumbBuilder
- Primary implementation for the Easy Breadcrumb builder.
Namespace
Drupal\easy_breadcrumbCode
protected function setRouteContextFromRouteMatch(RouteMatchInterface $route_match) {
try {
$url = $route_match
->getRouteObject() ? Url::fromRouteMatch($route_match) : NULL;
if ($url && ($request = $this
->getRequestForPath($url
->toString(), []))) {
$route_match_context = new RequestContext();
$route_match_context
->fromRequest($request);
$this->context = $route_match_context;
}
} catch (RouteNotFoundException $e) {
// Ignore the exception.
}
}