diff --git a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php index 1053d7c..8c7206e 100644 --- a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php +++ b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php @@ -135,17 +135,7 @@ public function build(array $attributes) { // Copy the path elements for up-casting. $route_request = $this->getRequestForPath(implode('/', $path_elements), $exclude); if ($route_request) { - // @todo - remove this once all of core is converted to the new router. - if ($route_request->attributes->get('_legacy')) { - $menu_item = $route_request->attributes->get('_drupal_menu_item'); - // Skip the breadcrumb step for menu items linking to the parent item. - if (($menu_item['type'] & MENU_LINKS_TO_PARENT) == MENU_LINKS_TO_PARENT) { - continue; - } - $access = $menu_item['access']; - $title = $menu_item['title']; - } - else { + if (!$route_request->attributes->get('_legacy')) { $route_name = $route_request->attributes->get(RouteObjectInterface::ROUTE_NAME); // Note that the parameters don't really matter here since we're // passing in the request which already has the upcast attributes. @@ -159,6 +149,16 @@ public function build(array $attributes) { $title = ''; } } + // @todo - remove this once all of core is converted to the new router. + else { + $menu_item = $route_request->attributes->get('_drupal_menu_item'); + // Skip the breadcrumb step for menu items linking to the parent item. + if (($menu_item['type'] & MENU_LINKS_TO_PARENT) == MENU_LINKS_TO_PARENT) { + continue; + } + $access = $menu_item['access']; + $title = $menu_item['title']; + } if ($access) { if (!$title) { // @todo Skip this part once we have a _title_callback, see @@ -194,6 +194,8 @@ protected function getRequestForPath($path, array $exclude) { if (!empty($exclude[$path])) { return NULL; } + // @todo Use the RequestHelper once https://drupal.org/node/2090293 is + // fixed. $request = Request::create($this->request->getBaseUrl() . '/' . $path); // Find the system path by resolving aliases, language prefix, etc. $processed = $this->pathProcessor->processInbound($path, $request);