Same name and namespace in other branches
  1. 8.x-1.x src/EasyBreadcrumbBuilder.php \Drupal\easy_breadcrumb\EasyBreadcrumbBuilder::setRouteContextFromRouteMatch()

Set request context from passed in $route_match if route is available.

Paramètres

Drupal\Core\Routing\RouteMatchInterface $route_match: The route match for the breadcrumb.

1 call to EasyBreadcrumbBuilder::setRouteContextFromRouteMatch()
EasyBreadcrumbBuilder::build dans src/EasyBreadcrumbBuilder.php

Fichier

src/EasyBreadcrumbBuilder.php, line 690

Classe

EasyBreadcrumbBuilder
Primary implementation for the Easy Breadcrumb builder.

Namespace

Drupal\easy_breadcrumb

Code

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.
    }
}