Trait Yiisoft\Yii\DataView\Pagination\PaginationContextTrait
| Implemented by | Yiisoft\ |
|---|
Trait providing context management functionality for pagination widgets.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| context() | Creates a new instance with the specified pagination context. | Yiisoft\ |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getContext() | Gets the current pagination context. | Yiisoft\ |
Method Details
Creates a new instance with the specified pagination context.
| public static context ( Yiisoft\ | ||
| $context | Yiisoft\ |
The pagination context to use. |
| return | static |
New instance with the specified context. |
|---|---|---|
final public function context(PaginationContext $context): static
{
$new = clone $this;
$new->context = $context;
return $new;
}
Gets the current pagination context.
| protected Yiisoft\ | ||
| return | Yiisoft\ |
The current pagination context. |
|---|---|---|
| throws | LogicException |
If the context has not been set. |
final protected function getContext(): PaginationContext
{
if ($this->context === null) {
throw new LogicException('Context is not set.');
}
return $this->context;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.