function PagerPluginBase::setCurrentPage

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/pager/PagerPluginBase.php \Drupal\views\Plugin\views\pager\PagerPluginBase::setCurrentPage()
  2. 10 core/modules/views/src/Plugin/views/pager/PagerPluginBase.php \Drupal\views\Plugin\views\pager\PagerPluginBase::setCurrentPage()
  3. 11.x core/modules/views/src/Plugin/views/pager/PagerPluginBase.php \Drupal\views\Plugin\views\pager\PagerPluginBase::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 global page array.

1 method overrides PagerPluginBase::setCurrentPage()
SqlBase::setCurrentPage in core/modules/views/src/Plugin/views/pager/SqlBase.php
Set the current page.

File

core/modules/views/src/Plugin/views/pager/PagerPluginBase.php, line 91

Class

PagerPluginBase
Base class for views pager plugins.

Namespace

Drupal\views\Plugin\views\pager

Code

public function setCurrentPage($number = NULL) {
    if (!is_numeric($number) || $number < 0) {
        $number = 0;
    }
    $this->current_page = $number;
}

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