You are here

function views_plugin_style_sgrid::render in Sortable Grid Views Plugin 7

Render the display in this style.

Overrides views_plugin_style::render

File

./views_plugin_style_sgrid.inc, line 56
Views style plugin for Sortable grid module

Class

views_plugin_style_sgrid
@file Views style plugin for Sortable grid module

Code

function render() {
  if ($this
    ->uses_row_plugin() && empty($this->row_plugin)) {
    debug('views_plugin_style_default: Missing row plugin');
    return;
  }

  // Group the rows according to the grouping field, if specified.
  $sets = $this
    ->render_grouping($this->view->result, $this->options['grouping']);

  // Render each group separately and concatenate.  Plugins may override this
  // method if they wish some other way of handling grouping.
  $output = '';
  foreach ($sets as $title => $records) {
    if ($this
      ->uses_row_plugin()) {
      $rows = array();
      foreach ($records as $row_index => $row) {
        $this->view->row_index = $row_index;
        $rows[$row_index] = $this->row_plugin
          ->render($row);
      }
    }
    else {
      $rows = $records;
    }
    $output .= theme($this
      ->theme_functions(), array(
      'view' => $this->view,
      'options' => $this->options,
      'rows' => $rows,
      'title' => $title,
    ));
  }
  unset($this->view->row_index);
  return $output;
}