You are here

public function PaginatorInterface::getPaginationLinks in JSON:API Resources 8

Get pagination links. Must not be called before executing the query.

Parameters

\Drupal\Core\Entity\Query\QueryInterface $executed_query: The executed query to which the paginator was applied. The query must have been executed and its results should have been saved. This method will modify the given query and render it unusable for fetching results.

\Drupal\Core\Cache\CacheableMetadata $cacheable_metadata: A CacheableMetadata object that will be used to capture any cacheability information generated while generating pagination links. The same object that is passed to this method should be added to the cacheability of the final response by the caller.

bool $calculate_last_link: (optional) Whether the paginator should attempt to calculate a `last` page link. By default, this is FALSE. Passing TRUE may require that entity query be re-executed in order to get a total count, which may make response times slower by increasing the time spent executing database requests.

Return value

\Drupal\jsonapi\JsonApiResource\LinkCollection An LinkCollection, with:

  • a 'next' key if it is not the last page;
  • 'prev' and 'first' keys if it's not the first page.
1 method overrides PaginatorInterface::getPaginationLinks()
OffsetLimitPaginator::getPaginationLinks in src/Unstable/Entity/Query/Pagination/OffsetLimitPaginator.php
Get pagination links. Must not be called before executing the query.

File

src/Entity/Query/PaginatorInterface.php, line 51

Class

PaginatorInterface
Interface EntityQueryModifierInterface.

Namespace

Drupal\jsonapi_resources\Entity\Query

Code

public function getPaginationLinks(QueryInterface $executed_query, CacheableMetadata $cacheable_metadata, $calculate_last_link = FALSE) : LinkCollection;