You are here

function views_handler_field_counter::render in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_field_counter.inc \views_handler_field_counter::render()
  2. 7.3 handlers/views_handler_field_counter.inc \views_handler_field_counter::render()

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides views_handler_field::render

File

handlers/views_handler_field_counter.inc, line 27

Class

views_handler_field_counter

Code

function render($values) {

  // Note:  1 is subtracted from the counter start value below because the
  // counter value is incremented by 1 at the end of this function.
  $count = is_numeric($this->options['counter_start']) ? $this->options['counter_start'] - 1 : 0;
  $pager = $this->view->pager;

  // Get the base count of the pager.
  if ($pager['use_pager']) {
    $count += $pager['items_per_page'] * $pager['current_page'] + $pager['offset'];
  }

  // Add the counter for the current site.
  $count += $this->view->row_index + 1;
  return $count;
}