You are here

function taxo_faceted_navigation_taxonomy_term_get_parent in Taxonomy Facets 7

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 taxo_faceted_navigation_taxonomy_term_get_parent()
taxo_faceted_navigation_taxonomy_term_get_siblings in ./taxo_faceted_navigation.module
Get siblings of taxonomy term.

File

./taxo_faceted_navigation.module, line 708
Taxo Faceted Navigation module code.

Code

function taxo_faceted_navigation_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;
}