You are here

function _panels_content_vocabulary_terms in Panels 6.2

Same name and namespace in other branches
  1. 5.2 content_types/vocabulary_terms.inc \_panels_content_vocabulary_terms()
1 call to _panels_content_vocabulary_terms()
panels_content_vocabulary_terms in content_types/vocabulary_terms.inc
Output function for the 'vocabulary terms' content type. Outputs a list of terms for the input vocabulary.

File

content_types/vocabulary_terms.inc, line 50

Code

function _panels_content_vocabulary_terms($vid, $max_depth, $depth = -1, $tid = 0) {
  $depth++;
  if ($max_depth != NULL && $depth == $max_depth) {
    return array();
  }
  $return = array();
  $query = db_query('SELECT t.name, t.tid FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d AND h.parent = %d ORDER BY t.weight ASC, t.name ASC', $vid, $tid);
  while ($result = db_fetch_object($query)) {
    $return[] = array(
      'data' => l($result->name, 'taxonomy/term/' . $result->tid),
      'children' => _panels_content_vocabulary_terms($vid, $max_depth, $depth, $result->tid),
    );
  }
  return $return;
}