function ctools_term_name_content_type_render

Render the custom content type.

File

plugins/content_types/term_context/term_name.inc, line 27

Code

function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $context) {
    if (empty($context) || empty($context->data)) {
        return;
    }
    // Get a shortcut to the term.
    $term = $context->data;
    // Load the vocabulary.
    $vocab = taxonomy_vocabulary_load($term->vid);
    // Generate the title.
    $content = !empty($conf['link']) ? l($term->name, 'taxonomy/term/' . $term->tid) : check_plain($term->name);
    // Build any surrounding markup if so configured.
    if (isset($conf['markup']) && $conf['markup'] != 'none') {
        $markup = '<' . $conf['markup'];
        if (!empty($conf['id'])) {
            $markup .= ' id="' . $conf['id'] . '"';
        }
        if (!empty($conf['class'])) {
            $markup .= ' class="' . $conf['class'] . '"';
        }
        $markup .= '>' . $content . '</' . $conf['markup'] . '>' . "\n";
        $content = $markup;
    }
    // Build the content type block.
    $block = new stdClass();
    $block->module = 'term_name';
    $block->title = t('Name');
    $block->content = $content;
    $block->delta = $term->tid;
    return $block;
}