0 follower

Final Class Yiisoft\Yii\DataView\GridView\Column\Base\FilterContext

InheritanceYiisoft\Yii\DataView\GridView\Column\Base\FilterContext

FilterContext provides context information for rendering and handling grid column filters.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Creates a new filter context instance. Yiisoft\Yii\DataView\GridView\Column\Base\FilterContext
getQueryValue() Get the value of a query parameter from the URL. Yiisoft\Yii\DataView\GridView\Column\Base\FilterContext

Property Details

Hide inherited properties

$cellInvalidClass public property
$errorsContainerAttributes public property
$formId public property
public string $formId null
$validationResult public property
public \Yiisoft\Validator\Result $validationResult null

Method Details

Hide inherited methods

__construct() public method

Creates a new filter context instance.

public mixed __construct ( string $formId, \Yiisoft\Validator\Result $validationResult, string|null $cellInvalidClass, array $errorsContainerAttributes, Yiisoft\Yii\DataView\Url\UrlParameterProviderInterface $urlParameterProvider )
$formId string

The unique identifier of the filter form. This ID is used to associate filter inputs with their form using the HTML form attribute.

$validationResult \Yiisoft\Validator\Result

The validation result containing any validation errors. Use this to check for errors and display appropriate messages.

$cellInvalidClass string|null

CSS class to be applied to cells with invalid filter values. Set to null to disable invalid state styling.

$errorsContainerAttributes array

HTML attributes for the container that displays validation errors. Use these to style and position error messages.

$urlParameterProvider Yiisoft\Yii\DataView\Url\UrlParameterProviderInterface

Provider for accessing URL parameters. Used to retrieve filter values from the current request.

                public function __construct(
    public readonly string $formId,
    public readonly Result $validationResult,
    public readonly ?string $cellInvalidClass,
    public readonly array $errorsContainerAttributes,
    private readonly UrlParameterProviderInterface $urlParameterProvider,
) {}

            
getQueryValue() public method

Get the value of a query parameter from the URL.

public string|null getQueryValue ( string $name )
$name string

The name of the query parameter to retrieve.

return string|null

The value of the query parameter or null if not found or if no URL parameter provider is configured.

                public function getQueryValue(string $name): ?string
{
    return $this->urlParameterProvider->get($name, UrlParameterType::Query);
}