PaginationHelper
in package
ILS Pagination Helper
This class helps build paginators for ILS-provided data.
Tags
Table of Contents
- getOptions() : array<string|int, mixed>
- Get paging settings and request data for paged ILS requests.
- getPaginator() : false|Paginator
- Build a paginator with the paging options and ILS results if necessary
- getSortList() : array<string|int, mixed>
- Support method for getPagingSetup() -- determine the list of sort options.
- validateSort() : string|bool
- Support method for getPagingSetup() -- validate the active sort option, returning either a valid sort method or false.
Methods
getOptions()
Get paging settings and request data for paged ILS requests.
public
getOptions(int $page, string $sort, int $defaultPageSize, array<string|int, mixed> $functionConfig) : array<string|int, mixed>
Parameters
- $page : int
-
Current page (1-based)
- $sort : string
-
Current sort setting (null for none)
- $defaultPageSize : int
-
Default page size
- $functionConfig : array<string|int, mixed>
-
Function config returned from the ILS
Return values
array<string|int, mixed> —getPaginator()
Build a paginator with the paging options and ILS results if necessary
public
getPaginator(array<string|int, mixed> $pageOptions, int $count, array<string|int, mixed> $records) : false|Paginator
Parameters
- $pageOptions : array<string|int, mixed>
-
Paging options and parameters (returned by the getOptions method)
- $count : int
-
Result count
- $records : array<string|int, mixed>
-
Result records
Return values
false|Paginator —getSortList()
Support method for getPagingSetup() -- determine the list of sort options.
protected
getSortList(array<string|int, mixed> $functionConfig, string $sort) : array<string|int, mixed>
Parameters
- $functionConfig : array<string|int, mixed>
-
Function config returned from the ILS
- $sort : string
-
Currently active sort option
Return values
array<string|int, mixed> —validateSort()
Support method for getPagingSetup() -- validate the active sort option, returning either a valid sort method or false.
protected
validateSort(array<string|int, mixed> $functionConfig, string $sort) : string|bool
Parameters
- $functionConfig : array<string|int, mixed>
-
Function config returned from the ILS
- $sort : string
-
The unvalidated user sort parameter