You are here

public function ViewExecutable::setOffset in Zircon Profile 8

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

Set the offset on the pager.

Parameters

int $offset: The pager offset.

File

core/modules/views/src/ViewExecutable.php, line 589
Contains \Drupal\views\ViewExecutable.

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);
  }
}