You are here

public function BlogBreadcrumbBuilder::applies in Blog 8.2

Same name and namespace in other branches
  1. 3.x src/BlogBreadcrumbBuilder.php \Drupal\blog\BlogBreadcrumbBuilder::applies()

Whether this breadcrumb builder should be used to build the breadcrumb.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

Return value

bool TRUE if this builder should be used or FALSE to let other builders decide.

Overrides BreadcrumbBuilderInterface::applies

File

src/BlogBreadcrumbBuilder.php, line 34

Class

BlogBreadcrumbBuilder
Build blog-specific breadcrumb.

Namespace

Drupal\blog

Code

public function applies(RouteMatchInterface $route_match) {
  if ($route_match
    ->getRouteName() == 'entity.node.canonical') {

    /**
    * @var \Drupal\node\NodeInterface $node
    */
    $node = $route_match
      ->getParameter('node');
    return $node
      ->bundle() == 'blog_post';
  }
  return FALSE;
}