function ctools_node_title_content_type_render

Render the custom content type.

File

plugins/content_types/node_context/node_title.inc, line 27

Code

function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $context) {
    if (!empty($context) && (empty($context->data) || empty($context->data->nid))) {
        return;
    }
    // Get a shortcut to the node.
    $node = $context->data;
    // Load information about the node type.
    $type = node_type_get_type($node);
    // Generate the title.
    $content = !empty($conf['link']) ? l($node->title, 'node/' . $node->nid) : check_plain($node->title);
    // 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 = 'node_title';
    $block->title = $type->title_label;
    $block->content = $content;
    $block->delta = $node->nid;
    return $block;
}