You are here

function taxonomy_facets_taxonomy_term_get_parent in Taxonomy Facets 7.2

Check if taxonomy term has parent.

Utility function that checks if given taxonomy term has parent.

Parameters

integer $tid: Term id.

Return value

integer Returns integer if parent found, null if no parent found.

1 call to taxonomy_facets_taxonomy_term_get_parent()
taxonomy_facets_taxonomy_term_get_siblings in ./taxonomy_facets.module
Get siblings of taxonomy term.

File

./taxonomy_facets.module, line 815
Taxo Faceted Navigation module code.

Code

function taxonomy_facets_taxonomy_term_get_parent($tid) {
  $result = db_query('SELECT parent FROM {taxonomy_term_hierarchy} WHERE tid = :tid', array(
    ':tid' => $tid,
  ));
  $parent = NULL;
  foreach ($result as $record) {
    $parent = $record->parent;
  }
  return $parent;
}