function taxonomy_term_is_page

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

Deprecated

in drupal:11.3.0 and is removed from drupal:13.0.0. There is no replacement, check the view mode instead during rendering.

See also

https://www.drupal.org/node/3542527

File

core/modules/taxonomy/taxonomy.module, line 54

Code

function taxonomy_term_is_page(Term $term) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. There is no replacement, check the view mode instead during rendering. See https://www.drupal.org/node/3542527', E_USER_DEPRECATED);
  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.