Skip to content
Snippets Groups Projects
Commit e7b458cb authored by Bohdan Mykhalchuk's avatar Bohdan Mykhalchuk Committed by Greg Boggs
Browse files

Issue #3437332 by rollins, oleksandr.roshchuk: Breadcrumbs do not work when...

Issue #3437332 by rollins, oleksandr.roshchuk: Breadcrumbs do not work when the site running in a subfolder
parent 4d19269c
No related branches found
No related tags found
1 merge request!104Issue #3437332 by rollins: Breadcrumbs do not work when the site running in a subfolder
Pipeline #136542 failed
......@@ -732,10 +732,17 @@ class EasyBreadcrumbBuilder implements BreadcrumbBuilderInterface {
protected function setRouteContextFromRouteMatch(RouteMatchInterface $route_match) {
try {
$url = $route_match->getRouteObject() ? Url::fromRouteMatch($route_match) : NULL;
if ($url && $request = $this->getRequestForPath($url->toString(TRUE)->getGeneratedUrl(), [])) {
$route_match_context = new RequestContext();
$route_match_context->fromRequest($request);
$this->context = $route_match_context;
if ($url) {
$url_path = $url->toString(TRUE)->getGeneratedUrl();
// Remove base path if drupal is installed in a subdirectory.
$url = strpos($url_path, base_path()) === 0 ?
preg_replace('/^' . str_replace('/', '\/', base_path()) . '/', '/', $url_path) :
$url_path;
if ($request = $this->getRequestForPath($url, [])) {
$route_match_context = new RequestContext();
$route_match_context->fromRequest($request);
$this->context = $route_match_context;
}
}
}
catch (RouteNotFoundException $e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment