Final Class Yiisoft\Yii\DataView\GridView\Column\RadioColumnRenderer
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
RadioColumnRenderer handles the rendering of radio button columns in a grid.
Public Methods
Method Details
public function renderBody(ColumnInterface $column, Cell $cell, DataContext $context): Cell
{
$inputAttributes = $column->inputAttributes;
$name = null;
$value = null;
if (!array_key_exists('name', $inputAttributes)) {
$name = 'radio-selection';
}
if (!array_key_exists('value', $inputAttributes)) {
$value = $context->key;
}
$input = Html::radio($name, $value, $inputAttributes);
$contentClosure = $column->content;
/** @var string|Stringable $content */
$content = $contentClosure === null ? $input : $contentClosure($input, $context);
return $cell
->addAttributes($column->bodyAttributes)
->content($content)
->encode(false);
}
public function renderColumn(ColumnInterface $column, Cell $cell, GlobalContext $context): Cell
{
return $cell->addAttributes($column->columnAttributes);
}
| public ?\ | ||
| $column | Yiisoft\ |
|
| $cell | Yiisoft\ |
|
| $context | Yiisoft\ |
|
public function renderHeader(ColumnInterface $column, Cell $cell, GlobalContext $context): ?Cell
{
$header = $column->header;
if ($header === null) {
return null;
}
return $cell
->addAttributes($column->headerAttributes)
->content($header);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.