Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TermBreadcrumbBuilder.php

function TermBreadcrumbBuilder::applies

Overrides BreadcrumbBuilderInterface::applies

File

core/modules/taxonomy/src/TermBreadcrumbBuilder.php, line 50

Class

TermBreadcrumbBuilder
Provides a custom taxonomy breadcrumb builder that uses the term hierarchy.

Namespace

Drupal\taxonomy

Code

public function applies(RouteMatchInterface $route_match, ?CacheableMetadata $cacheable_metadata = NULL) {
    // @todo Remove null safe operator in Drupal 12.0.0, see
    //   https://www.drupal.org/project/drupal/issues/3459277.
    $cacheable_metadata?->addCacheContexts([
        'route',
    ]);
    return $route_match->getRouteName() == 'entity.taxonomy_term.canonical' && $route_match->getParameter('taxonomy_term') instanceof TermInterface;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal