function views_plugin_style::render_grouping_sets

Render the grouping sets.

Plugins may override this method if they wish some other way of handling grouping.

Parameters

array $sets: Array containing the grouping sets to render.

int $level: Integer indicating the hierarchical level of the grouping.

Return value

string Rendered output of given grouping sets.

1 call to views_plugin_style::render_grouping_sets()
views_plugin_style::render in plugins/views_plugin_style.inc
Render the display in this style.

File

plugins/views_plugin_style.inc, line 373

Class

views_plugin_style
Base class to define a style plugin handler.

Code

public function render_grouping_sets($sets, $level = 0) {
    $output = '';
    foreach ($sets as $set) {
        $row = reset($set['rows']);
        $level = isset($set['level']) ? $set['level'] : 0;
        // Render as a grouping set.
        if (is_array($row) && isset($row['group'])) {
            $output .= theme(views_theme_functions('views_view_grouping', $this->view, $this->display), array(
                'view' => $this->view,
                'grouping' => $this->options['grouping'][$level],
                'grouping_level' => $level,
                'rows' => $set['rows'],
                'title' => $set['group'],
            ));
        }
        else {
            if ($this->uses_row_plugin()) {
                foreach ($set['rows'] as $index => $row) {
                    $this->view->row_index = $index;
                    $set['rows'][$index] = $this->row_plugin
                        ->render($row);
                }
            }
            $output .= theme($this->theme_functions(), array(
                'view' => $this->view,
                'options' => $this->options,
                'grouping_level' => $level,
                'rows' => $set['rows'],
                'title' => $set['group'],
            ));
        }
    }
    unset($this->view->row_index);
    return $output;
}