checkNodeType example

/** * Breadcrumb builder for forum nodes. */
class ForumNodeBreadcrumbBuilder extends ForumBreadcrumbBuilderBase {

  /** * {@inheritdoc} */
  public function applies(RouteMatchInterface $route_match) {
    return $route_match->getRouteName() == 'entity.node.canonical'
      && $route_match->getParameter('node')
      && $this->forumManager->checkNodeType($route_match->getParameter('node'));
  }

  /** * {@inheritdoc} */
  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = parent::build($route_match);
    $breadcrumb->addCacheContexts(['route']);

    $parents = $this->termStorage->loadAllParents($route_match->getParameter('node')->forum_tid);
    if ($parents) {
      
Home | Imprint | This part of the site doesn't use cookies.