function CommentBreadcrumbBuilder::applies

Same name and namespace in other branches
  1. 11.x core/modules/comment/src/CommentBreadcrumbBuilder.php \Drupal\comment\CommentBreadcrumbBuilder::applies()
  2. 10 core/modules/comment/src/CommentBreadcrumbBuilder.php \Drupal\comment\CommentBreadcrumbBuilder::applies()
  3. 9 core/modules/comment/src/CommentBreadcrumbBuilder.php \Drupal\comment\CommentBreadcrumbBuilder::applies()
  4. 8.9.x core/modules/comment/src/CommentBreadcrumbBuilder.php \Drupal\comment\CommentBreadcrumbBuilder::applies()

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

Parameters

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

\Drupal\Core\Cache\CacheableMetadata $cacheable_metadata: The cacheable metadata to add to if your check varies by or depends on something. Anything you specify here does not have to be repeated in the build() method as it will be merged in automatically.

Return value

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

Overrides BreadcrumbBuilderInterface::applies

File

core/modules/comment/src/CommentBreadcrumbBuilder.php, line 39

Class

CommentBreadcrumbBuilder
Class to define the comment breadcrumb builder.

Namespace

Drupal\comment

Code

public function applies(RouteMatchInterface $route_match, CacheableMetadata $cacheable_metadata) {
  $cacheable_metadata->addCacheContexts([
    'route',
  ]);
  return $route_match->getRouteName() == 'comment.reply' && $route_match->getParameter('entity');
}

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