You are here

function _views_row_insert_get_classes in Views Row Insert 7

Helper function, provides array of classes.

Parameters

array $options: Array of options from the plugin settings form.

int $count: An integer containing current row number.

int $max: Integer of total rows.

Return value

array Returns array of classes for the current row.

1 call to _views_row_insert_get_classes()
template_preprocess_views_row_insert in ./views_row_insert.module
Implements hook_preprocess_HOOK() for theme_views_row_insert().

File

./views_row_insert.module, line 57
Views Row Insert module.

Code

function _views_row_insert_get_classes(array $options, $count, $max) {
  $classes = array();
  $default_rows = isset($options['default_rows']) ? $options['default_rows'] : FALSE;
  $strip_rows = isset($options['strip_rows']) ? $options['strip_rows'] : FALSE;
  if ($default_rows) {
    $classes[] = 'views-row';
    $classes[] = 'views-row-' . $count;
  }
  if ($strip_rows) {
    $classes[] = 'views-row-' . ($count % 2 ? 'odd' : 'even');
    if ($count == 1) {
      $classes[] = 'views-row-first';
    }
    if ($count == $max) {
      $classes[] = 'views-row-last';
    }
  }
  return $classes;
}