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()

Output function for the 'vocabulary terms' content type. Outputs a list of terms for the input vocabulary.

1 string reference to 'panels_content_vocabulary_terms'
panels_vocabulary_terms_panels_content_types in content_types/vocabulary_terms.inc
Callback function to supply a list of content types.

File

content_types/vocabulary_terms.inc, line 26

Code

function panels_content_vocabulary_terms($subtype, $conf, $panel_args, $context) {
  $vocab = isset($context->data) ? drupal_clone($context->data) : NULL;
  $max_depth = !empty($conf['max_depth']) ? (int) $conf['max_depth'] : NULL;
  if ($conf['tree'] == FALSE) {
    $terms = taxonomy_get_tree($vocab->vid, 0, -1, $max_depth);
    $items = array();
    foreach ($terms as $term) {
      $items[] = l($term->name, 'taxonomy/term/' . $term->tid);
    }
    $output = theme('item_list', $items);
  }
  else {
    $output = theme('item_list', _panels_content_vocabulary_terms($vocab->vid, $max_depth));
  }
  $block = new stdClass();
  $block->module = 'node_type';
  $block->subject = $vocab->name;
  $block->content = $output;
  $block->delta = $vocab->tid;
  return $block;
}