function ForumNodeBreadcrumbBuilder::applies

Same name and namespace in other branches
  1. 9 core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php \Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder::applies()
  2. 8.9.x core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php \Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder::applies()
  3. 10 core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php \Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder::applies()

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

@todo Uncomment new method parameters before drupal:12.0.0, see https://www.drupal.org/project/drupal/issues/3459277.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match. phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch

\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/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php, line 16

Class

ForumNodeBreadcrumbBuilder
Breadcrumb builder for forum nodes.

Namespace

Drupal\forum\Breadcrumb

Code

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

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