$path_elements =
explode('/',
$path);
$exclude =
[];
// Don't show a link to the front-page path.
$front =
$this->config->
get('page.front'
);
$exclude[$front] = TRUE;
// /user is just a redirect, so skip it.
// @todo Find a better way to deal with /user.
$exclude['/user'
] = TRUE;
while (count($path_elements) > 1
) { array_pop($path_elements);
// Copy the path elements for up-casting.
$route_request =
$this->
getRequestForPath('/' .
implode('/',
$path_elements),
$exclude);
if ($route_request) { $route_match = RouteMatch::
createFromRequest($route_request);
$access =
$this->accessManager->
check($route_match,
$this->currentUser, NULL, TRUE
);
// The set of breadcrumb links depends on the access result, so merge
// the access result's cacheability metadata.
$breadcrumb =
$breadcrumb->
addCacheableDependency($access);
if ($access->
isAllowed()) { $title =
$this->titleResolver->
getTitle($route_request,
$route_match->
getRouteObject());
if (!
isset($title)) { // Fallback to using the raw path component as the title if the
// route is missing a _title or _title_callback attribute.