function views_content_views_row_content_type_render

Render the node_terms content type.

File

views_content/plugins/content_types/views_row.inc, line 32

Code

function views_content_views_row_content_type_render($subtype, $conf, $panel_args, $context) {
    if (empty($context) || empty($context->data)) {
        return;
    }
    // Build the content type block.
    $block = new stdClass();
    $block->module = 'views_row';
    $block->delta = $context->argument;
    $block->title = '';
    $block->content = '';
    // This guarantees the view is rendered normally which must happen.
    $view = views_content_context_get_view($context);
    $output = views_content_context_get_output($context);
    $sets = array();
    $plugin = $view->style_plugin;
    // If all rows have to be displayed then simply get the key of all rows.
    $row_indexes = array();
    if (empty($conf['rows'])) {
        if (is_array($output['rows'])) {
            $row_indexes = array_keys($output['rows']);
        }
    }
    else {
        // If a subset of rows is requested collect the list of row keys.
        foreach ($conf['rows'] as $index) {
            $row_indexes[] = $index - 1;
        }
    }
    if (empty($conf['use_fields']) || empty($plugin->row_plugin)) {
        foreach ($row_indexes as $row_index) {
            if (isset($output['rows'][$row_index])) {
                $sets[$plugin->groups[$row_index]][$row_index] = $output['rows'][$row_index];
            }
        }
    }
    else {
        // If we're using specific fields, go through and poke the 'exclude' flag.
        foreach ($view->field as $id => $field) {
            $view->field[$id]->options['exclude'] = empty($conf['fields'][$id]);
        }
        // Rerender just the rows we need.
        foreach ($row_indexes as $row_index) {
            $view->row_index = $row_index;
            if (!empty($view->result[$view->row_index])) {
                $sets[$plugin->groups[$view->row_index]][$view->row_index] = $plugin->row_plugin
                    ->render($view->result[$view->row_index]);
            }
            unset($view->row_index);
        }
    }
    foreach ($sets as $title => $rows) {
        $block->content .= theme($plugin->theme_functions(), array(
            'view' => $view,
            'options' => $plugin->options,
            'rows' => $rows,
            'title' => $title,
        ));
    }
    return $block;
}