function template_preprocess_views_view_unformatted in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 8.3 theme/theme.inc \template_preprocess_views_view_unformatted()
- 6.3 theme/theme.inc \template_preprocess_views_view_unformatted()
- 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
Code
function template_preprocess_views_view_unformatted(&$vars) {
$view = $vars['view'];
$rows = $vars['rows'];
$vars['classes'] = array();
// Set up striping values.
foreach ($rows as $id => $row) {
$row_classes = array();
$row_classes[] = 'views-row';
$row_classes[] = 'views-row-' . ($id + 1);
$row_classes[] = 'views-row-' . ($id % 2 ? 'even' : 'odd');
if ($id == 0) {
$row_classes[] = 'views-row-first';
}
if ($id == count($rows) - 1) {
$row_classes[] = 'views-row-last';
}
// Flatten the classes to a string for each row for the template file.
$vars['classes'][$id] = implode(' ', $row_classes);
}
}