function SqlBase::setCurrentPage

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::setCurrentPage()
  2. 8.9.x core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::setCurrentPage()
  3. 10 core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::setCurrentPage()

Set the current page.

Parameters

$number: If provided, the page number will be set to this. If NOT provided, the page number will be set from the pager manager service.

Overrides PagerPluginBase::setCurrentPage

1 call to SqlBase::setCurrentPage()
SqlBase::updatePageInfo in core/modules/views/src/Plugin/views/pager/SqlBase.php
Update global paging info.

File

core/modules/views/src/Plugin/views/pager/SqlBase.php, line 307

Class

SqlBase
A common base class for sql based pager.

Namespace

Drupal\views\Plugin\views\pager

Code

public function setCurrentPage($number = NULL) {
    if (isset($number)) {
        $this->current_page = max(0, $number);
        return;
    }
    $this->current_page = max(0, $this->pagerParameters
        ->findPage($this->options['id']));
}

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