You are here

function template_preprocess_views_view_unformatted in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 8.3 theme/theme.inc \template_preprocess_views_view_unformatted()
  2. 6.2 theme/theme.inc \template_preprocess_views_view_unformatted()
  3. 7.3 theme/theme.inc \template_preprocess_views_view_unformatted()

Display the simple view of rows one after another

1 call to template_preprocess_views_view_unformatted()
template_preprocess_views_view_list in theme/theme.inc
Display the view as an HTML list element

File

theme/theme.inc, line 664
theme.inc

Code

function template_preprocess_views_view_unformatted(&$vars) {
  $view = $vars['view'];
  $rows = $vars['rows'];
  $vars['classes'] = array();

  // Set up striping values.
  $count = 0;
  $max = count($rows);
  foreach ($rows as $id => $row) {
    $count++;
    $row_classes = array();
    $row_classes[] = 'views-row';
    $row_classes[] = 'views-row-' . $count;
    $row_classes[] = 'views-row-' . ($count % 2 ? 'odd' : 'even');
    if ($count == 1) {
      $row_classes[] = 'views-row-first';
    }
    if ($count == $max) {
      $row_classes[] = 'views-row-last';
    }
    if ($row_class = $view->style_plugin
      ->get_row_class($id)) {
      $row_classes[] = $row_class;
    }

    // Flatten the classes to a string for each row for the template file.
    $vars['classes'][$id] = implode(' ', $row_classes);
  }
}