You are here

function template_preprocess_views_view_sgrid in Sortable Grid Views Plugin 6

Same name and namespace in other branches
  1. 7 sgrid_theme.inc \template_preprocess_views_view_sgrid()

Display the view as an HTML list element

File

./sgrid_theme.inc, line 11
Theme functions for Sortable Grid module

Code

function template_preprocess_views_view_sgrid(&$vars) {
  $view = $vars['view'];
  $handler = $view->style_plugin;
  $vars['class'] = views_css_safe($handler->options['class']);
  $vars['wrapper_class'] = views_css_safe($handler->options['wrapper_class']);
  $vars['wrapper_prefix'] = '';
  $vars['wrapper_suffix'] = '';
  $vars['list_type_prefix'] = '<' . $handler->options['type'] . '>';
  $vars['list_type_suffix'] = '</' . $handler->options['type'] . '>';
  if ($vars['wrapper_class']) {
    $vars['wrapper_prefix'] = '<div class="' . $vars['wrapper_class'] . '">';
    $vars['wrapper_suffix'] = '</div>';
  }
  if ($vars['class']) {
    $vars['list_type_prefix'] = '<' . $handler->options['type'] . ' class="' . $vars['class'] . '">';
  }

  // Add the 'end of line' class to the appropriate row
  $sgrid_end_of_line = array();
  foreach ($view->result as $id => $row) {
    if (is_int(($id + 1) / $view->style_options['row_length'])) {
      $vars['sgrid_end_of_line'][$id + 1] = ' sgrid-line-end';
    }
  }
  $vars['row_length'] = $view->style_options['row_length'];
  template_preprocess_views_view_unformatted($vars);
}