function ForumBreadcrumbBuilderBase::build

Same name in other branches
  1. 8.9.x core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase::build()
  2. 10 core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase::build()
  3. 11.x core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase::build()

Overrides BreadcrumbBuilderInterface::build

2 calls to ForumBreadcrumbBuilderBase::build()
ForumListingBreadcrumbBuilder::build in core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
Builds the breadcrumb.
ForumNodeBreadcrumbBuilder::build in core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
Builds the breadcrumb.
2 methods override ForumBreadcrumbBuilderBase::build()
ForumListingBreadcrumbBuilder::build in core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
Builds the breadcrumb.
ForumNodeBreadcrumbBuilder::build in core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
Builds the breadcrumb.

File

core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php, line 75

Class

ForumBreadcrumbBuilderBase
Provides a forum breadcrumb base class.

Namespace

Drupal\forum\Breadcrumb

Code

public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new Breadcrumb();
    $breadcrumb->addCacheContexts([
        'route',
    ]);
    $links[] = Link::createFromRoute($this->t('Home'), '<front>');
    $vocabulary = $this->entityTypeManager
        ->getStorage('taxonomy_vocabulary')
        ->load($this->config
        ->get('vocabulary'));
    $breadcrumb->addCacheableDependency($vocabulary);
    $links[] = Link::createFromRoute($vocabulary->label(), 'forum.index');
    return $breadcrumb->setLinks($links);
}

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