function _lineage_get_parent_lineage in Taxonomy Lineage 7
Same name and namespace in other branches
- 5 lineage.module \_lineage_get_parent_lineage()
- 6 lineage.module \_lineage_get_parent_lineage()
Recursive helper to assemble lineage.
Parameters
$id: A taxonomy term id.
Return value
An keyed array containg the following keys:
- base
- depth
1 call to _lineage_get_parent_lineage()
File
- ./
lineage.module, line 327 - lineage.module Module code for taxonomy term hierarchy lineage.
Code
function _lineage_get_parent_lineage($tid) {
$query = db_select('taxonomy_term_hierarchy', 'th');
$query
->join('taxonomy_term_data', 'td', 'td.tid = th.tid');
$query
->fields('td', array(
'tid',
'name',
'weight',
'vid',
));
$query
->fields('th', array(
'parent',
));
$query
->condition('td.tid', $tid, '=');
$result = $query
->execute();
foreach ($result as $term) {
$ret = _lineage_get_parent_lineage($term->parent);
$ret['base'] .= lineage_string($term);
$ret['depth'] += 1;
return $ret;
}
// Return an empty set to suppress warnings in lineage_update_term_r().
return array(
'base' => '',
'depth' => 0,
);
}