Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewExecutable.php

function ViewExecutable::setCurrentPage

Sets the current page for the pager.

Parameters

int $page: The current page.

1 call to ViewExecutable::setCurrentPage()
ViewExecutable::__wakeup in core/modules/views/src/ViewExecutable.php
Magic method implementation to unserialize the view executable.

File

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

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal