public function ForumBreadcrumbBuilderBase::build in Drupal 9
Same name and namespace in other branches
- 8 core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase::build()
Builds the breadcrumb.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
Return value
\Drupal\Core\Breadcrumb\Breadcrumb A breadcrumb.
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\BreadcrumbCode
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);
}