diff --git a/core/modules/book/lib/Drupal/book/BookBreadcrumbBuilder.php b/core/modules/book/lib/Drupal/book/BookBreadcrumbBuilder.php index dce04da..d64693f 100644 --- a/core/modules/book/lib/Drupal/book/BookBreadcrumbBuilder.php +++ b/core/modules/book/lib/Drupal/book/BookBreadcrumbBuilder.php @@ -60,11 +60,9 @@ public function __construct(EntityManager $entity_manager, TranslationInterface */ public function build(array $attributes) { // @todo - like \Drupal\forum\ForumBreadcrumbBuilder this depends on the - // legacy non-route node view. It must be updated once that's converted. + // legacy non-route node view, see https://drupal.org/node/1987778. if (!empty($attributes['_drupal_menu_item']) && !empty($attributes['_drupal_menu_item']['map'][1]->book)) { $mlids = array(); - // @todo Replace with link generator service when - // https://drupal.org/node/2047619 lands. $links = array($this->linkGenerator->generate($this->t('Home'), '')); $book = $attributes['_drupal_menu_item']['map'][1]->book; $depth = 1; @@ -79,7 +77,8 @@ public function build(array $attributes) { while (!empty($book['p' . ($depth + 1)])) { if (!empty($menu_links[$book['p' . $depth]]) && ($menu_link = $menu_links[$book['p' . $depth]])) { // Legacy hook_menu page callback. - // @todo change this once thie node view route is converted. + // @todo change this once the node view route is converted, see + // https://drupal.org/node/1987778. if ($item = menu_get_item($menu_link->link_path)) { if ($item['access']) { $links[] = l($menu_link->label(), $menu_link->link_path, $menu_link->options); diff --git a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php index a7cc598..dd42006 100644 --- a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php +++ b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php @@ -80,6 +80,7 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface { * * @var \Drupal\Core\Config\Config */ + protected $config; /** * Constructs the MenuLinkBreadcrumbBuilder. @@ -109,7 +110,7 @@ public function __construct(Request $request, EntityManager $entity_manager, Acc $this->router = $router; $this->pathProcessor = $path_processor; $this->config = $config_factory->get('system.site'); - $this->link_generator = $link_generator; + $this->linkGenerator = $link_generator; } /** @@ -165,8 +166,6 @@ public function build(array $attributes) { } } - // @todo Replace with a #type => link render element or using the link - // generator. if ($path && $path != $front) { // Add the Home link, except for the front page. $links[] = $this->linkGenerator->generate($this->t('Home'), ''); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php index 29740ce..8470901 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php @@ -408,8 +408,8 @@ function testBreadCrumbs() { $this->assertBreadcrumb('admin', $trail, t('Access denied')); $this->assertResponse(403); - // Since the 'admin' path is not accessible, we still expect - // only the Home link. + // Since the 'admin' path is not accessible, we still expect only the Home + // link. $this->assertBreadcrumb('admin/reports', $trail, t('Reports')); $this->assertNoResponse(403); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 75c5f83..2378947 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1354,9 +1354,11 @@ function hook_module_implements_alter(&$implementations, $hook) { * Perform alterations to the breadcrumb built by \Drupal\Core\Breadcrumb\BreadcrumbManager. * * @param array $breadcrumb - * Array of breadcrumb links. + * An array of breadcrumb links, returned by the breadcrumb manager build + * method. * @param array $attributes - * Attributes representing the current page. + * Attributes representing the current page, coming from + * \Drupal::request()->attributes. * @param array $context * May include the following keys: * - builder: the instance of \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface