You are here

protected function ListUsageController::getPageRows in Entity Usage 8.4

Same name and namespace in other branches
  1. 8.2 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::getPageRows()
  2. 8.3 src/Controller/ListUsageController.php \Drupal\entity_usage\Controller\ListUsageController::getPageRows()

Get rows for a given page.

Parameters

int $page: The page number to retrieve.

int $num_per_page: The number of rows we want to have on this page.

string $entity_type: The type of the target entity.

int|string $entity_id: The ID of the target entity.

Return value

array An indexed array of rows representing the records for a given page.

1 call to ListUsageController::getPageRows()
ListUsageController::listUsagePage in src/Controller/ListUsageController.php
Lists the usage of a given entity.

File

src/Controller/ListUsageController.php, line 260

Class

ListUsageController
Controller for our pages.

Namespace

Drupal\entity_usage\Controller

Code

protected function getPageRows($page, $num_per_page, $entity_type, $entity_id) {
  $offset = $page * $num_per_page;
  return array_slice($this
    ->getRows($entity_type, $entity_id), $offset, $num_per_page);
}