function taxonomy_term_is_page

Same name in other branches
  1. 7.x modules/taxonomy/taxonomy.module \taxonomy_term_is_page()
  2. 8.9.x core/modules/taxonomy/taxonomy.module \taxonomy_term_is_page()
  3. 10 core/modules/taxonomy/taxonomy.module \taxonomy_term_is_page()
  4. 11.x core/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

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;
}

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