Trait Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait
| Implemented by | Yiisoft\Yii\DataView\PageSize\InputPageSize, Yiisoft\Yii\DataView\PageSize\SelectPageSize |
|---|
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\Yii\DataView\PageSize\PageSizeContextTrait |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getContext() | Gets the current page size context. | Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait |
Method Details
Gets the current page size context.
| protected Yiisoft\Yii\DataView\PageSize\PageSizeContext getContext ( ) | ||
| return | Yiisoft\Yii\DataView\PageSize\PageSizeContext |
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 Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait withContext ( Yiisoft\Yii\DataView\PageSize\PageSizeContext $context ) | ||
| $context | Yiisoft\Yii\DataView\PageSize\PageSizeContext |
The page size context to use. |
| return | Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait |
New instance with the specified context. |
|---|---|---|
final public function withContext(PageSizeContext $context): static
{
$new = clone $this;
$new->context = $context;
return $new;
}
Signup or Login in order to comment.