function template_preprocess_views_view_unformatted

Same name in other branches
  1. 6.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 828

Code

function template_preprocess_views_view_unformatted(&$vars) {
    $view = $vars['view'];
    $rows = $vars['rows'];
    $style = $view->style_plugin;
    $options = $style->options;
    $vars['classes_array'] = array();
    $vars['classes'] = array();
    $default_row_class = isset($options['default_row_class']) ? $options['default_row_class'] : FALSE;
    $row_class_special = isset($options['row_class_special']) ? $options['row_class_special'] : FALSE;
    // Set up striping values.
    $count = 0;
    $max = count($rows);
    foreach ($rows as $id => $row) {
        $count++;
        if ($default_row_class) {
            $vars['classes'][$id][] = 'views-row';
            $vars['classes'][$id][] = 'views-row-' . $count;
        }
        if ($row_class_special) {
            $vars['classes'][$id][] = 'views-row-' . ($count % 2 ? 'odd' : 'even');
            if ($count == 1) {
                $vars['classes'][$id][] = 'views-row-first';
            }
            if ($count == $max) {
                $vars['classes'][$id][] = 'views-row-last';
            }
        }
        if ($row_class = $view->style_plugin
            ->get_row_class($id)) {
            $vars['classes'][$id][] = $row_class;
        }
        // Flatten the classes to a string for each row for the template file.
        $vars['classes_array'][$id] = isset($vars['classes'][$id]) ? implode(' ', $vars['classes'][$id]) : '';
    }
}