function BookBreadcrumbBuilder::applies

Same name in other branches
  1. 9 core/modules/book/src/BookBreadcrumbBuilder.php \Drupal\book\BookBreadcrumbBuilder::applies()
  2. 8.9.x core/modules/book/src/BookBreadcrumbBuilder.php \Drupal\book\BookBreadcrumbBuilder::applies()
  3. 11.x core/modules/book/src/BookBreadcrumbBuilder.php \Drupal\book\BookBreadcrumbBuilder::applies()

Overrides BreadcrumbBuilderInterface::applies

File

core/modules/book/src/BookBreadcrumbBuilder.php, line 74

Class

BookBreadcrumbBuilder
Provides a breadcrumb builder for nodes in a book.

Namespace

Drupal\book

Code

public function applies(RouteMatchInterface $route_match, ?CacheableMetadata $cacheable_metadata = NULL) {
    $cacheable_metadata?->addCacheContexts([
        'route.book_navigation',
    ]);
    $node = $route_match->getParameter('node');
    return $node instanceof NodeInterface && !empty($node->book);
}

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