Final Class Yiisoft\Yii\DataView\Pagination\PaginationContext
| Inheritance | Yiisoft\ |
|---|
Context class for pagination widgets that provides URL generation and configuration.
Public Properties
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| createUrl() | Creates a URL for the given page token. | Yiisoft\ |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| URL_PLACEHOLDER | 'YII-DATAVIEW-PAGE-PLACEHOLDER' | Placeholder used in URL patterns that will be replaced with the actual page token. | Yiisoft\ |
Property Details
Method Details
| public mixed __construct ( string $nextUrlPattern, string $previousUrlPattern, string $firstPageUrl ) | ||
| $nextUrlPattern | string |
URL pattern for next page links. Must contain {@see \ |
| $previousUrlPattern | string |
URL pattern for previous page links. Must contain {@see \ |
| $firstPageUrl | string |
URL used on the first page. |
public function __construct(
public readonly string $nextUrlPattern,
public readonly string $previousUrlPattern,
public readonly string $firstPageUrl,
) {}
Creates a URL for the given page token.
This method replaces the URL_PLACEHOLDER in either the next or previous URL pattern (depending on the token type) with the URL-encoded token value.
| public string createUrl ( \ | ||
| $pageToken | \ |
Token for the page. |
| return | string |
The generated URL with the token value properly encoded. |
|---|---|---|
public function createUrl(PageToken $pageToken): string
{
return str_replace(
self::URL_PLACEHOLDER,
urlencode($pageToken->value),
$pageToken->isPrevious ? $this->previousUrlPattern : $this->nextUrlPattern,
);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.