You are here

function template_preprocess_views_view_sgrid in Sortable Grid Views Plugin 7

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

Display the view as an HTML list element

File

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

Code

function template_preprocess_views_view_sgrid(&$vars) {
  $handler = $vars['view']->style_plugin;
  $vars['class'] = drupal_clean_css_identifier($handler->options['class']);
  $vars['wrapper_class'] = drupal_clean_css_identifier($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 ($vars['rows'] as $id => $row) {
    if (is_int(($id + 1) / $handler->options['row_length'])) {
      $vars['sgrid_end_of_line'][$id + 1] = ' sgrid-line-end';
    }
  }

  // Provide the row length setting to the template for Javascript management
  $vars['row_length'] = $handler->options['row_length'];
  template_preprocess_views_view_unformatted($vars);
}