Skip to content
PHP Ecosystem
Explore

FilterRemoval

API reference › Yii3 Debug › Web › FilterRemoval

final classYii3\Debug\Web\FilterRemoval
Sourcesrc/Web/FilterRemoval.php

Rewrites a panel filter group in the query parameters and renders the banner dropping single filters: replaces the group with the active filters or removes selected attributes while resetting pagination, without changing unrelated navigation parameters.

MethodDescriptionDefined by
banner() staticRenders the active-filter banner whose links remove single filters from the panel query.FilterRemoval
queryParams() staticReturns the query parameters with the named filter removed.FilterRemoval
withGroup() staticReplaces the filter group with the active filters, or removes it when no filter is active.FilterRemoval
public static function banner(array<string, string> $activeFilters, PHPForge\Debug\Panel\PanelRenderContext $context, array<array-key, mixed> $queryParams, string $prefix): string

Renders the active-filter banner whose links remove single filters from the panel query.

The clear-all link drops the union of the submitted group keys and the active ones, so values the panel search rejected are cleared together with the filters they left out.

Parameters

ParameterTypeDescription
$activeFiltersarray<string, string>Attribute-to-value map of the currently applied filters.
$contextPHPForge\Debug\Panel\PanelRenderContextContext resolving the panel URL and exposing the submitted query.
$queryParamsarray<array-key, mixed>Query parameters already normalized by the panel.
$prefixstringFilter group the removed attributes belong to.

Returns

string: Rendered banner, or '' when no filter is active.

public static function queryParams(array<array-key, mixed> $queryParams, string $prefix, list<string> $without): array<array-key, mixed>

Returns the query parameters with the named filter removed.

Parameters

ParameterTypeDescription
$queryParamsarray<array-key, mixed>Query parameters already normalized by the panel.
$prefixstringFilter group to update.
$withoutlist<string>Attributes to remove from that group.

Returns

array<array-key, mixed>: Query parameters without those attributes.

public static function withGroup(array<array-key, mixed> $queryParams, string $prefix, array<string, string> $filters, list<string> $drop = []): array<array-key, mixed>

Replaces the filter group with the active filters, or removes it when no filter is active.

The group keeps its current position in the query, so link query strings preserve their parameter order.

Parameters

ParameterTypeDescription
$queryParamsarray<array-key, mixed>Query parameters already normalized by the panel.
$prefixstringFilter group to replace.
$filtersarray<string, string>Active filters; an empty set removes the group.
$droplist<string>Unrelated parameters to remove, such as view.

Returns

array<array-key, mixed>: Query parameters carrying the replaced group.