1.20.x views.theme.inc template_preprocess_views_view_unformatted(&$variables)

Display the simple view of rows one after another

File

modules/views/templates/views.theme.inc, line 891
Preprocessors and helper functions to make theme development easier.

Code

function template_preprocess_views_view_unformatted(&$variables) {
  $view = $variables['view'];
  $rows = $variables['rows'];
  $style = $view->style_plugin;
  $options = $style->options;

  $variables['row_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++;
    $variables['row_classes'][$id] = array();
    if ($default_row_class) {
      $variables['row_classes'][$id][] = 'views-row';
      $variables['row_classes'][$id][] = 'views-row-' . $count;
    }
    if ($row_class_special) {
      $variables['row_classes'][$id][] = ($count % 2 ? 'odd' : 'even');
      if ($count == 1) {
        $variables['row_classes'][$id][] = 'first';
      }
      if ($count == $max) {
        $variables['row_classes'][$id][] = 'last';
      }
    }

    if ($row_class = $view->style_plugin->get_row_class($id)) {
      $variables['row_classes'][$id][] = $row_class;
    }
  }
}