function ViewExecutable::setOffset

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setOffset()
  2. 10 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setOffset()
  3. 11.x 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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.