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 276
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;
}
doc_Drupal
2016-10-29 09:46:32
Comments
Leave a Comment

Please login to continue.