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