ViewExecutable::setCurrentPage

public ViewExecutable::setCurrentPage($page)

Sets the current page for the pager.

Parameters

int $page: The current page.

File

core/modules/views/src/ViewExecutable.php, line 509

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function setCurrentPage($page) {
  $this->current_page = $page;

  // Calls like ::unserialize() might call this method without a proper $page.
  // Also check whether the element is pre rendered. At that point, the cache
  // keys cannot longer be manipulated.
  if ($page !== NULL && empty($this->element['#pre_rendered'])) {
    $this->element['#cache']['keys'][] = 'page:' . $page;
  }

  // If the pager is already initialized, pass it through to the pager.
  if (!empty($this->pager)) {
    return $this->pager->setCurrentPage($page);
  }
}
doc_Drupal
2016-10-29 09:54:27
Comments
Leave a Comment

Please login to continue.