You are here

public function SqlBase::setCurrentPage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::setCurrentPage()
  2. 9 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 298

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