class HelpBreadcrumbBuilder

Same name in this branch
  1. 10 core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder
Same name in other branches
  1. 9 core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder
  2. 8.9.x core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder
  3. 11.x core/modules/help_topics/src/HelpBreadcrumbBuilder.php \Drupal\help_topics\HelpBreadcrumbBuilder
  4. 11.x core/modules/help/src/HelpBreadcrumbBuilder.php \Drupal\help\HelpBreadcrumbBuilder

Provides a breadcrumb builder for help topic pages.

@internal Tagged services are internal.

Hierarchy

Expanded class hierarchy of HelpBreadcrumbBuilder

1 file declares its use of HelpBreadcrumbBuilder
HelpBreadcrumbBuilder.php in core/modules/help_topics/src/HelpBreadcrumbBuilder.php
1 string reference to 'HelpBreadcrumbBuilder'
help.services.yml in core/modules/help/help.services.yml
core/modules/help/help.services.yml
1 service uses HelpBreadcrumbBuilder
help.breadcrumb in core/modules/help/help.services.yml
Drupal\help\HelpBreadcrumbBuilder

File

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

Namespace

Drupal\help
View source
class HelpBreadcrumbBuilder implements BreadcrumbBuilderInterface {
    
    /**
     * {@inheritdoc}
     */
    public function applies(RouteMatchInterface $route_match) {
        return $route_match->getRouteName() == 'help.help_topic';
    }
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
HelpBreadcrumbBuilder::applies public function Whether this breadcrumb builder should be used to build the breadcrumb. Overrides BreadcrumbBuilderInterface::applies
HelpBreadcrumbBuilder::build public function Builds the breadcrumb. Overrides BreadcrumbBuilderInterface::build

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