You are here

function taxonomy_manager_term_is_root in Taxonomy Manager 7

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.module \taxonomy_manager_term_is_root()

helper function to check whether a given term is a root term

1 call to taxonomy_manager_term_is_root()
_taxonomy_manager_tree_get_first_path in ./taxonomy_manager.module
calculates a path to a certain term and merges it into the tree

File

./taxonomy_manager.module, line 536
Taxonomy Manager

Code

function taxonomy_manager_term_is_root($tid) {
  $is_root = (bool) db_query_range("SELECT 1 FROM {taxonomy_term_hierarchy} h WHERE h.tid = :tid AND h.parent = 0", 0, 1, array(
    ':tid' => $tid,
  ))
    ->fetchField();
  if ($is_root) {
    return TRUE;
  }
  return FALSE;
}