function template_preprocess_views_view_unformatted

Same name in other branches
  1. 7.x-3.x 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

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);
    }
}