You are here

function _taxonomy_CrumbsPlugin__hierarchy::findParent__taxonomy_term__ in Crumbs, the Breadcrumbs suite 6

Terms get their parent terms as breadcrumb parent. The method name matches the router path "taxonomy/term/%".

File

plugins/crumbs.taxonomy.inc, line 30

Class

_taxonomy_CrumbsPlugin__hierarchy

Code

function findParent__taxonomy_term__($path, $item) {
  $terms = $item['fragments'][2];
  $terms = taxonomy_terms_parse_string($terms);
  if (isset($terms['tids']) && count($terms['tids']) === 1) {
    $tid = $terms['tids'][0];
    $q = db_query($sql = "\n        SELECT h.parent, d.vid\n        FROM {term_hierarchy} h\n        LEFT JOIN {term_data} d ON (h.tid = d.tid)\n        WHERE d.tid = %d\n        GROUP BY d.vid\n      ", $tid);
    $result = array();
    while ($row = db_fetch_object($q)) {
      if ($row->parent) {
        $result['voc_' . $row->vid] = 'taxonomy/term/' . $row->parent;
      }
    }
    return $result;
  }
}