Skip to content
PHP Ecosystem
Explore

GridViewConfig

API reference › Debug › GridViewConfig

final classyii\debug\GridViewConfig
Sourcesrc/GridViewConfig.php

Shared default configuration for GridView widgets rendered inside the debug panel UI.

Centralizes the pager markup, table classes, and row-status helpers so every GridView::widget(...) call in the debug views emits consistent, namespaced, framework-agnostic markup.

MethodDescriptionDefined by
defaults() staticReturns the default GridView options for the debug UI.GridViewConfig
pageSizeSelectorHtml() staticReturns the inline page-size selector markup rendered inside the GridView footer.GridViewConfig
paginationFromRequest() staticReturns a pagination config keyed off the per-page query parameter.GridViewConfig
rowClassFor() staticReturns the row-options array carrying the yii-debug-row-<variant> CSS class for the given status level.GridViewConfig
sortParams() staticReturns the current request query parameters without the page cursor.GridViewConfig
public static function defaults(): array{dataColumnClass: class-string<yii\debug\widgets\DebugDataColumn>, tableOptions: array{class: string}, options: array{class: string}, layout: string, pager: array{options: array{class: string}, linkContainerOptions: array{class: string}, linkOptions: array{class: string}, disabledListItemSubTagOptions: array{tag: string, class: string}, activePageCssClass: string, disabledPageCssClass: string}}

Returns the default GridView options for the debug UI.

Carries the namespaced yii-debug-* CSS classes (so the debug styles never clash with the host application’s grid styles), the custom layout that confines the table to a .yii-debug-table-wrap scroll container and wraps the summary and pager into a single footer, and the pager’s active/disabled CSS modifiers used by the debug stylesheet.

The summary carries no options because GridView::renderSummary() renders it through the shared GridCount renderer, which owns the wrapper markup.

Returns

array{dataColumnClass: class-string<yii\debug\widgets\DebugDataColumn>, tableOptions: array{class: string}, options: array{class: string}, layout: string, pager: array{options: array{class: string}, linkContainerOptions: array{class: string}, linkOptions: array{class: string}, disabledListItemSubTagOptions: array{tag: string, class: string}, activePageCssClass: string, disabledPageCssClass: string}}: GridView config array ready to splat into GridView::widget([...]).

public static function pageSizeSelectorHtml(): string

Returns the inline page-size selector markup rendered inside the GridView footer.

The dropdown lets the user switch between 10 / 25 / 50 / 100 / All rows per page. JavaScript wired in debug.min.js picks up the change event, rewrites the per-page query param, and reloads the panel while keeping every other filter/sort param intact.

Returns

string: HTML markup for the page-size selector.

public static function paginationFromRequest(positive-int $default = 50): array<string, mixed>|false

Returns a pagination config keyed off the per-page query parameter.

Reads per-page from the parsed request query and translates it into a Yii pagination array. The literal string 'all' (case-insensitive) disables pagination entirely. Numeric values are honored within a hard cap of 1000 rows per page; anything else falls back to $default.

Parameters

ParameterTypeDescription
$defaultpositive-intPage size used when no per-page param is supplied or the value is invalid.

Returns

array<string, mixed>|false: false when 'all' was requested, otherwise a pagination config carrying pageSize, pageSizeParam, and pageSizeLimit.

public static function rowClassFor(string|null $level): array<string, mixed>

Returns the row-options array carrying the yii-debug-row-<variant> CSS class for the given status level.

Accepts success, info, warning, danger, and error (aliased to danger). Unknown or empty levels yield an empty array, so the caller can splat the result safely.

Parameters

ParameterTypeDescription
$levelstring|nullStatus keyword, or null to skip the class.

Returns

array<string, mixed>: Row-options array with the class key set, or [] for unknown/null levels.

public static function sortParams(): array<array-key, mixed>

Returns the current request query parameters without the page cursor.

Feeding the result to a data provider’s sort configuration makes every sort link land on page one, matching the Yii3 debugger, while preserving the active filters, the page size, and the current sort semantics.

Returns

array<array-key, mixed>: Query parameters with page removed.