0 follower

Final Class Yiisoft\Yii\DataView\GridView\Column\RadioColumn

InheritanceYiisoft\Yii\DataView\GridView\Column\RadioColumn
ImplementsYiisoft\Yii\DataView\GridView\Column\ColumnInterface

RadioColumn displays a column of radio buttons in a grid view.

This column type is typically used when you need to allow users to select a single row from the grid. Each radio button in the column shares the same name attribute, ensuring only one can be selected at a time.

Property Details

Hide inherited properties

$bodyAttributes public property
public array $bodyAttributes = []
$columnAttributes public property
$content public property
public Closure|null $content null
$footer public property
public string|null $footer null
$header public property
public string|null $header null
$headerAttributes public property
$inputAttributes public property
public array $inputAttributes = []

Method Details

Hide inherited methods

__construct() public method

Creates a new RadioColumn instance.

public mixed __construct ( string|null $header null, string|null $footer null, array $columnAttributes = [], array $headerAttributes = [], array $bodyAttributes = [], array $inputAttributes = [], string|null $name null, Closure|null $content null, boolean $visible true )
$header string|null

The header cell content. If null, no header will be rendered.

$footer string|null

The footer cell content. If null, no footer will be rendered.

$columnAttributes array

HTML attributes for all column cells.

$headerAttributes array

HTML attributes for the header cell.

$bodyAttributes array

HTML attributes for the body cells.

$inputAttributes array

HTML attributes for the radio input elements. The name attribute will be set from the $name parameter if provided.

$name string|null

The name attribute for all radio inputs in this column. All radio buttons will share this name, ensuring single selection.

$content Closure|null

Optional callback to generate the radio button value. Signature: function($model): string.

$visible boolean

Whether the column is visible.

                public function __construct(
    public readonly ?string $header = null,
    public readonly ?string $footer = null,
    public readonly array $columnAttributes = [],
    public readonly array $headerAttributes = [],
    public readonly array $bodyAttributes = [],
    public array $inputAttributes = [],
    ?string $name = null,
    public ?Closure $content = null,
    private readonly bool $visible = true,
) {
    if ($name !== null) {
        $this->inputAttributes['name'] = $name;
    }
}

            
getRenderer() public method

public string getRenderer ( )

                public function getRenderer(): string
{
    return RadioColumnRenderer::class;
}

            
isVisible() public method

public boolean isVisible ( )

                public function isVisible(): bool
{
    return $this->visible;
}