You are here

public function ViewExecutable::setOffset in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setOffset()

Sets the offset on the pager.

Parameters

int $offset: The pager offset.

File

core/modules/views/src/ViewExecutable.php, line 613

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function setOffset($offset) {

  // Check whether the element is pre rendered. At that point, the cache keys
  // cannot longer be manipulated.
  if (empty($this->element['#pre_rendered'])) {
    $this->element['#cache']['keys'][] = 'offset:' . $offset;
  }
  $this->offset = $offset;

  // If the pager is already initialized, pass it through to the pager.
  if (!empty($this->pager)) {
    $this->pager
      ->setOffset($offset);
  }
}