Fr3nch13/CakePHP Utilities

PaginatorHelper extends Helper
in package
uses StringTemplateTrait

Pagination Helper class for easy generation of pagination links.

PaginationHelper encloses all methods needed when working with pagination.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html

Table of Contents

Properties

$Form  : FormHelper
$Html  : HtmlHelper
$Number  : NumberHelper
$Url  : UrlHelper
$_config  : array<string, mixed>
Runtime config
$_configInitialized  : bool
Whether the config property has already been configured with defaults
$_defaultConfig  : array<string, mixed>
Default config for this class
$_defaultModel  : string|null
Default model of the paged sets
$_helperMap  : array<string, array<string|int, mixed>>
A helper lookup table used to lazy load helper objects.
$_templater  : StringTemplate|null
StringTemplate instance.
$_View  : View
The View instance this helper is attached to
$helpers  : array<string|int, mixed>
List of helpers used by this helper

Methods

__call()  : mixed|void
Provide non fatal errors on missing method calls.
__construct()  : mixed
Constructor. Overridden to merge passed args with URL options.
__debugInfo()  : array<string, mixed>
Returns an array that can be used to describe the internal state of this object.
__get()  : Helper|null|void
Lazy loads helpers.
addClass()  : array<string, mixed>
Adds the given class to the element options
configShallow()  : $this
Merge provided config with existing config. Unlike `config()` which does a recursive merge for nested keys, this method does a simple merge.
counter()  : string
Returns a counter string for the paged result set.
current()  : int
Gets the current page of the recordset for the given model
defaultModel()  : string|null
Gets or sets the default model of the paged sets
first()  : string
Returns a first or set of numbers for the first pages.
formatTemplate()  : string
Formats a template string with $data
generateUrl()  : string
Merges passed URL options with current pagination state to generate a pagination URL.
generateUrlParams()  : array<string|int, mixed>
Merges passed URL options with current pagination state to generate a pagination URL.
getConfig()  : mixed
Returns the config.
getConfigOrFail()  : mixed
Returns the config for this specific key.
getTemplates()  : array<string|int, mixed>|string
Gets templates to use or a specific template.
getView()  : View
Get the view instance this helper is bound to.
hasNext()  : bool
Returns true if the given result set is not at the last page
hasPage()  : bool
Returns true if the given result set has the page number given by $page
hasPrev()  : bool
Returns true if the given result set is not at the first page
implementedEvents()  : array<string, mixed>
Event listeners.
initialize()  : void
Constructor hook method.
last()  : string
Returns a last or set of numbers for the last pages.
limitControl()  : string
Dropdown select for pagination limit.
meta()  : string|null
Returns the meta-links for a paginated result set.
next()  : string
Generates a "next" link for a set of paged records
numbers()  : string
Returns a set of numbers for the paged result set uses a modulus to decide how many numbers to show on each side of the current page (default: 8).
options()  : void
Sets default options for all pagination links
param()  : mixed
Convenience access to any of the paginator params.
params()  : array<string|int, mixed>
Gets the current paging parameters from the resultset for the given model
prev()  : string
Generates a "previous" link for a set of paged records
setConfig()  : $this
Sets the config.
setTemplates()  : $this
Sets templates to use.
sort()  : string
Generates a sorting link. Sets named parameters for the sort and direction. Handles direction switching automatically.
sortDir()  : string
Gets the current direction the recordset is sorted
sortKey()  : string|null
Gets the current key by which the recordset is sorted
templater()  : StringTemplate
Returns the templater instance.
total()  : int
Gets the total number of pages in the recordset for the given model.
_configDelete()  : void
Deletes a single config key.
_configRead()  : mixed
Reads a config key.
_configWrite()  : void
Writes a config key.
_confirm()  : string
Returns a string to be used as onclick handler for confirm dialogs.
_firstNumber()  : string
Generates the first number for the paginator numbers() method.
_formatNumber()  : string
Formats a number for the paginator number output.
_getNumbersStartAndEnd()  : array<string|int, mixed>
Calculates the start and end for the pagination numbers.
_hasPage()  : bool
Does $model have $page in its range?
_lastNumber()  : string
Generates the last number for the paginator numbers() method.
_modulusNumbers()  : string
Generates the numbers for the paginator numbers() method.
_numbers()  : string
Generates the numbers for the paginator numbers() method.
_removeAlias()  : string
Remove alias if needed.
_toggledLink()  : string
Generate an active/inactive link for next/prev methods.

Properties

$_configInitialized

Whether the config property has already been configured with defaults

protected bool $_configInitialized = false

$_defaultConfig

Default config for this class

protected array<string, mixed> $_defaultConfig = ['options' => [], 'templates' => ['nextActive' => '<li class="next"><a rel="next" href="{{url}}">{{text}}</a></li>', 'nextDisabled' => '<li class="next disabled"><a href="" onclick="return false;">{{text}}</a></li>', 'prevActive' => '<li class="prev"><a rel="prev" href="{{url}}">{{text}}</a></li>', 'prevDisabled' => '<li class="prev disabled"><a href="" onclick="return false;">{{text}}</a></li>', 'counterRange' => '{{start}} - {{end}} of {{count}}', 'counterPages' => '{{page}} of {{pages}}', 'first' => '<li class="first"><a href="{{url}}">{{text}}</a></li>', 'last' => '<li class="last"><a href="{{url}}">{{text}}</a></li>', 'number' => '<li><a href="{{url}}">{{text}}</a></li>', 'current' => '<li class="active"><a href="">{{text}}</a></li>', 'ellipsis' => '<li class="ellipsis">&hellip;</li>', 'sort' => '<a href="{{url}}">{{text}}</a>', 'sortAsc' => '<a class="asc" href="{{url}}">{{text}}</a>', 'sortDesc' => '<a class="desc" href="{{url}}">{{text}}</a>', 'sortAscLocked' => '<a class="asc locked" href="{{url}}">{{text}}</a>', 'sortDescLocked' => '<a class="desc locked" href="{{url}}">{{text}}</a>']]

Options: Holds the default options for pagination links

The values that may be specified are:

  • url Url of the action. See Router::url()
  • url['?']['sort'] the key that the recordset is sorted.
  • url['?']['direction'] Direction of the sorting (default: 'asc').
  • url['?']['page'] Page number to use in links.
  • model The name of the model.
  • escape Defines if the title field for the link should be escaped (default: true).
  • routePlaceholders An array specifying which paging params should be passed as route placeholders instead of query string parameters. The array can have values 'sort', 'direction', 'page'.

Templates: the templates used by this class

$_defaultModel

Default model of the paged sets

protected string|null $_defaultModel

$_helperMap

A helper lookup table used to lazy load helper objects.

protected array<string, array<string|int, mixed>> $_helperMap = []

$_View

The View instance this helper is attached to

protected View $_View

$helpers

List of helpers used by this helper

protected array<string|int, mixed> $helpers = ['Url', 'Number', 'Html', 'Form']

Methods

__call()

Provide non fatal errors on missing method calls.

public __call(string $method, array<string|int, mixed> $params) : mixed|void
Parameters
$method : string

Method to invoke

$params : array<string|int, mixed>

Array of params for the method.

Return values
mixed|void

__construct()

Constructor. Overridden to merge passed args with URL options.

public __construct(View $view[, array<string, mixed> $config = [] ]) : mixed
Parameters
$view : View

The View this helper is being attached to.

$config : array<string, mixed> = []

Configuration settings for the helper.

__debugInfo()

Returns an array that can be used to describe the internal state of this object.

public __debugInfo() : array<string, mixed>
Return values
array<string, mixed>

__get()

Lazy loads helpers.

public __get(string $name) : Helper|null|void
Parameters
$name : string

Name of the property being accessed.

Return values
Helper|null|void

Helper instance if helper with provided name exists

addClass()

Adds the given class to the element options

public addClass(array<string, mixed> $options, string $class[, string $key = 'class' ]) : array<string, mixed>
Parameters
$options : array<string, mixed>

Array options/attributes to add a class to

$class : string

The class name being added.

$key : string = 'class'

the key to use for class. Defaults to 'class'.

Return values
array<string, mixed>

Array of options with $key set.

configShallow()

Merge provided config with existing config. Unlike `config()` which does a recursive merge for nested keys, this method does a simple merge.

public configShallow(array<string, mixed>|string $key[, mixed|null $value = null ]) : $this

Setting a specific value:

$this->configShallow('key', $value);

Setting a nested value:

$this->configShallow('some.nested.key', $value);

Updating multiple config settings at the same time:

$this->configShallow(['one' => 'value', 'another' => 'value']);
Parameters
$key : array<string, mixed>|string

The key to set, or a complete array of configs.

$value : mixed|null = null

The value to set.

Return values
$this

counter()

Returns a counter string for the paged result set.

public counter([string $format = 'pages' ][, array<string, mixed> $options = [] ]) : string

Options

  • model The model to use, defaults to PaginatorHelper::defaultModel();
Parameters
$format : string = 'pages'

The format string you want to use, defaults to 'pages' Which generates output like '1 of 5' set to 'range' to generate output like '1 - 3 of 13'. Can also be set to a custom string, containing the following placeholders {{page}}, {{pages}}, {{current}}, {{count}}, {{model}}, {{start}}, {{end}} and any custom content you would like.

$options : array<string, mixed> = []

Options for the counter string. See #options for list of keys. If string it will be used as format.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-a-page-counter
Return values
string

Counter string.

defaultModel()

Gets or sets the default model of the paged sets

public defaultModel([string|null $model = null ]) : string|null
Parameters
$model : string|null = null

Model name to set

Return values
string|null

Model name or null if the pagination isn't initialized.

first()

Returns a first or set of numbers for the first pages.

public first([string|int $first = '<< first' ][, array<string, mixed> $options = [] ]) : string
echo $this->Paginator->first('< first');

Creates a single link for the first page. Will output nothing if you are on the first page.

echo $this->Paginator->first(3);

Will create links for the first 3 pages, once you get to the third or greater page. Prior to that nothing will be output.

Options:

  • model The model to use defaults to PaginatorHelper::defaultModel()
  • escape Whether to HTML escape the text.
  • url An array of additional URL options to use for link generation.
Parameters
$first : string|int = '<< first'

if string use as label for the link. If numeric, the number of page links you want at the beginning of the range.

$options : array<string, mixed> = []

An array of options.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-jump-links
Return values
string

Numbers string.

formatTemplate()

Formats a template string with $data

public formatTemplate(string $name, array<string, mixed> $data) : string
Parameters
$name : string

The template name.

$data : array<string, mixed>

The data to insert.

Return values
string

generateUrl()

Merges passed URL options with current pagination state to generate a pagination URL.

public generateUrl([array<string, mixed> $options = [] ][, string|null $model = null ][, array<string|int, mixed> $url = [] ][, array<string, mixed> $urlOptions = [] ]) : string

Url options:

  • escape: If false, the URL will be returned unescaped, do only use if it is manually escaped afterwards before being displayed.
  • fullBase: If true, the full base URL will be prepended to the result
Parameters
$options : array<string, mixed> = []

Pagination options.

$model : string|null = null

Which model to paginate on

$url : array<string|int, mixed> = []

URL.

$urlOptions : array<string, mixed> = []

Array of options

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#generating-pagination-urls
Return values
string

By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)

generateUrlParams()

Merges passed URL options with current pagination state to generate a pagination URL.

public generateUrlParams([array<string, mixed> $options = [] ][, string|null $model = null ][, array<string|int, mixed> $url = [] ]) : array<string|int, mixed>
Parameters
$options : array<string, mixed> = []

Pagination/URL options array

$model : string|null = null

Which model to paginate on

$url : array<string|int, mixed> = []

URL.

Return values
array<string|int, mixed>

An array of URL parameters

getConfig()

Returns the config.

public getConfig([string|null $key = null ][, mixed $default = null ]) : mixed

Usage

Reading the whole config:

$this->getConfig();

Reading a specific value:

$this->getConfig('key');

Reading a nested value:

$this->getConfig('some.nested.key');

Reading with default value:

$this->getConfig('some-key', 'default-value');
Parameters
$key : string|null = null

The key to get or null for the whole config.

$default : mixed = null

The return value when the key does not exist.

Return values
mixed

Configuration data at the named key or null if the key does not exist.

getConfigOrFail()

Returns the config for this specific key.

public getConfigOrFail(string $key) : mixed

The config value for this key must exist, it can never be null.

Parameters
$key : string

The key to get.

Tags
throws
InvalidArgumentException
Return values
mixed

Configuration data at the named key

getTemplates()

Gets templates to use or a specific template.

public getTemplates([string|null $template = null ]) : array<string|int, mixed>|string
Parameters
$template : string|null = null

String for reading a specific template, null for all.

Return values
array<string|int, mixed>|string

getView()

Get the view instance this helper is bound to.

public getView() : View
Return values
View

The bound view instance.

hasPage()

Returns true if the given result set has the page number given by $page

public hasPage([int $page = 1 ][, string|null $model = null ]) : bool
Parameters
$page : int = 1

The page number - if not set defaults to 1.

$model : string|null = null

Optional model name. Uses the default if none is specified.

Tags
throws
InvalidArgumentException
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#checking-the-pagination-state
Return values
bool

True if the given result set has the specified page number.

implementedEvents()

Event listeners.

public implementedEvents() : array<string, mixed>
Return values
array<string, mixed>

initialize()

Constructor hook method.

public initialize(array<string, mixed> $config) : void

Implement this method to avoid having to overwrite the constructor and call parent.

Parameters
$config : array<string, mixed>

The configuration settings provided to this helper.

last()

Returns a last or set of numbers for the last pages.

public last([string|int $last = 'last >>' ][, array<string, mixed> $options = [] ]) : string
echo $this->Paginator->last('last >');

Creates a single link for the last page. Will output nothing if you are on the last page.

echo $this->Paginator->last(3);

Will create links for the last 3 pages. Once you enter the page range, no output will be created.

Options:

  • model The model to use defaults to PaginatorHelper::defaultModel()
  • escape Whether to HTML escape the text.
  • url An array of additional URL options to use for link generation.
Parameters
$last : string|int = 'last >>'

if string use as label for the link, if numeric print page numbers

$options : array<string, mixed> = []

Array of options

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-jump-links
Return values
string

Numbers string.

limitControl()

Dropdown select for pagination limit.

public limitControl([array<string, string> $limits = [] ][, int|null $default = null ][, array<string, mixed> $options = [] ]) : string

This will generate a wrapping form.

Parameters
$limits : array<string, string> = []

The options array.

$default : int|null = null

Default option for pagination limit. Defaults to $this->param('perPage').

$options : array<string, mixed> = []

Options for Select tag attributes like class, id or event

Return values
string

html output.

meta()

Returns the meta-links for a paginated result set.

public meta([array<string, mixed> $options = [] ]) : string|null
echo $this->Paginator->meta();

Echos the links directly, will output nothing if there is neither a previous nor next page.

$this->Paginator->meta(['block' => true]);

Will append the output of the meta function to the named block - if true is passed the "meta" block is used.

Options:

  • model The model to use defaults to PaginatorHelper::defaultModel()
  • block The block name to append the output to, or false/absent to return as a string
  • prev (default True) True to generate meta for previous page
  • next (default True) True to generate meta for next page
  • first (default False) True to generate meta for first page
  • last (default False) True to generate meta for last page
Parameters
$options : array<string, mixed> = []

Array of options

Return values
string|null

Meta links

next()

Generates a "next" link for a set of paged records

public next([string $title = 'Next >>' ][, array<string, mixed> $options = [] ]) : string

Options:

  • disabledTitle The text to used when the link is disabled. This defaults to the same text at the active link. Setting to false will cause this method to return ''.
  • escape Whether you want the contents html entity encoded, defaults to true
  • model The model to use, defaults to PaginatorHelper::defaultModel()
  • url An array of additional URL options to use for link generation.
  • templates An array of templates, or template file name containing the templates you'd like to use when generating the link for next page. The helper's original templates will be restored once next() is done.
Parameters
$title : string = 'Next >>'

Title for the link. Defaults to 'Next >>'.

$options : array<string, mixed> = []

Options for pagination link. See above for list of keys.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-jump-links
Return values
string

A "next" link or $disabledTitle text if the link is disabled.

numbers()

Returns a set of numbers for the paged result set uses a modulus to decide how many numbers to show on each side of the current page (default: 8).

public numbers([array<string, mixed> $options = [] ]) : string
$this->Paginator->numbers(['first' => 2, 'last' => 2]);

Using the first and last options you can create links to the beginning and end of the page set.

Options

  • before Content to be inserted before the numbers, but after the first links.
  • after Content to be inserted after the numbers, but before the last links.
  • model Model to create numbers for, defaults to PaginatorHelper::defaultModel()
  • modulus How many numbers to include on either side of the current page, defaults to 8. Set to false to disable and to show all numbers.
  • first Whether you want first links generated, set to an integer to define the number of 'first' links to generate. If a string is set a link to the first page will be generated with the value as the title.
  • last Whether you want last links generated, set to an integer to define the number of 'last' links to generate. If a string is set a link to the last page will be generated with the value as the title.
  • templates An array of templates, or template file name containing the templates you'd like to use when generating the numbers. The helper's original templates will be restored once numbers() is done.
  • url An array of additional URL options to use for link generation.

The generated number links will include the 'ellipsis' template when the first and last options and the number of pages exceed the modulus. For example if you have 25 pages, and use the first/last options and a modulus of 8, ellipsis content will be inserted after the first and last link sets.

Parameters
$options : array<string, mixed> = []

Options for the numbers.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-page-number-links
Return values
string

Numbers string.

options()

Sets default options for all pagination links

public options([array<string, mixed> $options = [] ]) : void
Parameters
$options : array<string, mixed> = []

Default options for pagination links. See PaginatorHelper::$options for list of keys.

param()

Convenience access to any of the paginator params.

public param(string $key[, string|null $model = null ]) : mixed
Parameters
$key : string

Key of the paginator params array to retrieve.

$model : string|null = null

Optional model name. Uses the default if none is specified.

Return values
mixed

Content of the requested param.

params()

Gets the current paging parameters from the resultset for the given model

public params([string|null $model = null ]) : array<string|int, mixed>
Parameters
$model : string|null = null

Optional model name. Uses the default if none is specified.

Return values
array<string|int, mixed>

The array of paging parameters for the paginated resultset.

prev()

Generates a "previous" link for a set of paged records

public prev([string $title = '<< Previous' ][, array<string, mixed> $options = [] ]) : string

Options:

  • disabledTitle The text to used when the link is disabled. This defaults to the same text at the active link. Setting to false will cause this method to return ''.
  • escape Whether you want the contents html entity encoded, defaults to true
  • model The model to use, defaults to PaginatorHelper::defaultModel()
  • url An array of additional URL options to use for link generation.
  • templates An array of templates, or template file name containing the templates you'd like to use when generating the link for previous page. The helper's original templates will be restored once prev() is done.
Parameters
$title : string = '<< Previous'

Title for the link. Defaults to '<< Previous'.

$options : array<string, mixed> = []

Options for pagination link. See above for list of keys.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-jump-links
Return values
string

A "previous" link or a disabled link.

setConfig()

Sets the config.

public setConfig(array<string, mixed>|string $key[, mixed|null $value = null ][, bool $merge = true ]) : $this

Usage

Setting a specific value:

$this->setConfig('key', $value);

Setting a nested value:

$this->setConfig('some.nested.key', $value);

Updating multiple config settings at the same time:

$this->setConfig(['one' => 'value', 'another' => 'value']);
Parameters
$key : array<string, mixed>|string

The key to set, or a complete array of configs.

$value : mixed|null = null

The value to set.

$merge : bool = true

Whether to recursively merge or overwrite existing config, defaults to true.

Tags
throws
CakeException

When trying to set a key that is invalid.

Return values
$this

setTemplates()

Sets templates to use.

public setTemplates(array<string|int, string> $templates) : $this
Parameters
$templates : array<string|int, string>

Templates to be added.

Return values
$this

sort()

Generates a sorting link. Sets named parameters for the sort and direction. Handles direction switching automatically.

public sort(string $key[, array<string, mixed>|string|null $title = null ][, array<string, mixed> $options = [] ]) : string

Options:

  • escape Whether you want the contents html entity encoded, defaults to true.
  • model The model to use, defaults to PaginatorHelper::defaultModel().
  • direction The default direction to use when this link isn't active.
  • lock Lock direction. Will only use the default direction then, defaults to false.
Parameters
$key : string

The name of the key that the recordset should be sorted.

$title : array<string, mixed>|string|null = null

Title for the link. If $title is null $key will be used for the title and will be generated by inflection. It can also be an array with keys asc and desc for specifying separate titles based on the direction.

$options : array<string, mixed> = []

Options for sorting link. See above for list of keys.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-sort-links
Return values
string

A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified key the returned link will sort by 'desc'.

sortDir()

Gets the current direction the recordset is sorted

public sortDir([string|null $model = null ][, array<string, mixed> $options = [] ]) : string
Parameters
$model : string|null = null

Optional model name. Uses the default if none is specified.

$options : array<string, mixed> = []

Options for pagination links.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-sort-links
Return values
string

The direction by which the recordset is being sorted, or null if the results are not currently sorted.

sortKey()

Gets the current key by which the recordset is sorted

public sortKey([string|null $model = null ][, array<string, mixed> $options = [] ]) : string|null
Parameters
$model : string|null = null

Optional model name. Uses the default if none is specified.

$options : array<string, mixed> = []

Options for pagination links.

Tags
link
https://book.cakephp.org/4/en/views/helpers/paginator.html#creating-sort-links
Return values
string|null

The name of the key by which the recordset is being sorted, or null if the results are not currently sorted.

total()

Gets the total number of pages in the recordset for the given model.

public total([string|null $model = null ]) : int
Parameters
$model : string|null = null

Optional model name. Uses the default if none is specified.

Return values
int

The total pages for the recordset.

_configDelete()

Deletes a single config key.

protected _configDelete(string $key) : void
Parameters
$key : string

Key to delete.

Tags
throws
CakeException

if attempting to clobber existing config

_configRead()

Reads a config key.

protected _configRead(string|null $key) : mixed
Parameters
$key : string|null

Key to read.

_configWrite()

Writes a config key.

protected _configWrite(array<string, mixed>|string $key, mixed $value[, string|bool $merge = false ]) : void
Parameters
$key : array<string, mixed>|string

Key to write to.

$value : mixed

Value to write.

$merge : string|bool = false

True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.

Tags
throws
CakeException

if attempting to clobber existing config

_confirm()

Returns a string to be used as onclick handler for confirm dialogs.

protected _confirm(string $okCode, string $cancelCode) : string
Parameters
$okCode : string

Code to be executed after user chose 'OK'

$cancelCode : string

Code to be executed after user chose 'Cancel'

Return values
string

"onclick" JS code

_firstNumber()

Generates the first number for the paginator numbers() method.

protected _firstNumber(string $ellipsis, array<string, mixed> $params, int $start, array<string, mixed> $options) : string
Parameters
$ellipsis : string

Ellipsis character.

$params : array<string, mixed>

Params from the numbers() method.

$start : int

Start number.

$options : array<string, mixed>

Options from the numbers() method.

Return values
string

Markup output.

_formatNumber()

Formats a number for the paginator number output.

protected _formatNumber(StringTemplate $templater, array<string, mixed> $options) : string
Parameters
$templater : StringTemplate

StringTemplate instance.

$options : array<string, mixed>

Options from the numbers() method.

Return values
string

_getNumbersStartAndEnd()

Calculates the start and end for the pagination numbers.

protected _getNumbersStartAndEnd(array<string, mixed> $params, array<string, mixed> $options) : array<string|int, mixed>
Parameters
$params : array<string, mixed>

Params from the numbers() method.

$options : array<string, mixed>

Options from the numbers() method.

Tags
psalm-return

array{0: int, 1: int}

Return values
array<string|int, mixed>

An array with the start and end numbers.

_hasPage()

Does $model have $page in its range?

protected _hasPage(string|null $model, string $dir) : bool
Parameters
$model : string|null

Model name to get parameters for.

$dir : string

Direction

Return values
bool

Whether model has $dir

_lastNumber()

Generates the last number for the paginator numbers() method.

protected _lastNumber(string $ellipsis, array<string, mixed> $params, int $end, array<string, mixed> $options) : string
Parameters
$ellipsis : string

Ellipsis character.

$params : array<string, mixed>

Params from the numbers() method.

$end : int

End number.

$options : array<string, mixed>

Options from the numbers() method.

Return values
string

Markup output.

_modulusNumbers()

Generates the numbers for the paginator numbers() method.

protected _modulusNumbers(StringTemplate $templater, array<string, mixed> $params, array<string, mixed> $options) : string
Parameters
$templater : StringTemplate

StringTemplate instance.

$params : array<string, mixed>

Params from the numbers() method.

$options : array<string, mixed>

Options from the numbers() method.

Return values
string

Markup output.

_numbers()

Generates the numbers for the paginator numbers() method.

protected _numbers(StringTemplate $templater, array<string, mixed> $params, array<string, mixed> $options) : string
Parameters
$templater : StringTemplate

StringTemplate instance.

$params : array<string, mixed>

Params from the numbers() method.

$options : array<string, mixed>

Options from the numbers() method.

Return values
string

Markup output.

_removeAlias()

Remove alias if needed.

protected _removeAlias(string $field[, string|null $model = null ]) : string
Parameters
$field : string

Current field

$model : string|null = null

Current model alias

Return values
string

Unaliased field if applicable

Generate an active/inactive link for next/prev methods.

protected _toggledLink(string|false $text, bool $enabled, array<string, mixed> $options, array<string, mixed> $templates) : string
Parameters
$text : string|false

The enabled text for the link.

$enabled : bool

Whether the enabled/disabled version should be created.

$options : array<string, mixed>

An array of options from the calling method.

$templates : array<string, mixed>

An array of templates with the 'active' and 'disabled' keys.

Return values
string

Generated HTML


        
On this page

Search results