function taxonomy_term_is_page in Drupal 9
Same name and namespace in other branches
- 8 core/modules/taxonomy/taxonomy.module \taxonomy_term_is_page()
- 7 modules/taxonomy/taxonomy.module \taxonomy_term_is_page()
Returns whether the current page is the page of the passed-in term.
Parameters
\Drupal\taxonomy\Entity\Term $term: A taxonomy term entity.
1 call to taxonomy_term_is_page()
- template_preprocess_taxonomy_term in core/modules/ taxonomy/ taxonomy.module 
- Prepares variables for taxonomy term templates.
File
- core/modules/ taxonomy/ taxonomy.module, line 147 
- Enables the organization of content into categories.
Code
function taxonomy_term_is_page(Term $term) {
  if (\Drupal::routeMatch()
    ->getRouteName() == 'entity.taxonomy_term.canonical' && ($page_term_id = \Drupal::routeMatch()
    ->getRawParameter('taxonomy_term'))) {
    return $page_term_id == $term
      ->id();
  }
  return FALSE;
}