function HelpBreadcrumbBuilder::build

Same name in other branches
  1. 9 core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder::build()
  2. 8.9.x core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder::build()
  3. 11.x core/modules/help/src/HelpBreadcrumbBuilder.php \Drupal\help\HelpBreadcrumbBuilder::build()

Overrides BreadcrumbBuilderInterface::build

File

core/modules/help/src/HelpBreadcrumbBuilder.php, line 29

Class

HelpBreadcrumbBuilder
Provides a breadcrumb builder for help topic pages.

Namespace

Drupal\help

Code

public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new Breadcrumb();
    $breadcrumb->addCacheContexts([
        'url.path.parent',
    ]);
    $breadcrumb->addLink(Link::createFromRoute(new TranslatableMarkup('Home'), '<front>'));
    $breadcrumb->addLink(Link::createFromRoute(new TranslatableMarkup('Administration'), 'system.admin'));
    $breadcrumb->addLink(Link::createFromRoute(new TranslatableMarkup('Help'), 'help.main'));
    return $breadcrumb;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.