0 follower

Trait Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait

Implemented byYiisoft\Yii\DataView\PageSize\InputPageSize, Yiisoft\Yii\DataView\PageSize\SelectPageSize

Trait providing context management functionality for page size widgets.

Public Methods

Hide inherited methods

Method Description Defined By
withContext() Creates a new instance with the specified page size context. Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait

Protected Methods

Hide inherited methods

Method Description Defined By
getContext() Gets the current page size context. Yiisoft\Yii\DataView\PageSize\PageSizeContextTrait

Method Details

Hide inherited methods

getContext() protected method

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;
}

            
withContext() public method

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;
}