function taxonomy_term_is_page

taxonomy_term_is_page(Term $term)

Returns whether the current page is the page of the passed-in term.

Parameters

\Drupal\taxonomy\Entity\Term $term: A taxonomy term entity.

File

core/modules/taxonomy/taxonomy.module, line 266
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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!taxonomy!taxonomy.module/function/taxonomy_term_is_page/8.1.x