function ctools_vocabulary_terms_content_type_render

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

File

plugins/content_types/vocabulary_context/vocabulary_terms.inc, line 27

Code

function ctools_vocabulary_terms_content_type_render($subtype, $conf, $panel_args, $context) {
    $vocab = isset($context->data) ? 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, $max_depth);
        $items = array();
        foreach ($terms as $term) {
            $items[] = l($term->name, 'taxonomy/term/' . $term->tid);
        }
        $output = theme('item_list', array(
            'items' => $items,
        ));
    }
    else {
        $output = theme('item_list', array(
            'items' => _ctools_content_vocabulary_terms($vocab->vid, $max_depth),
        ));
    }
    $block = new stdClass();
    $block->module = 'node_type';
    $block->title = check_plain($vocab->name);
    $block->content = $output;
    $block->delta = $vocab->vid;
    return $block;
}