Final Class Yiisoft\Yii\DataView\GridView\Column\CheckboxColumnRenderer
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
CheckboxColumnRenderer renders checkbox inputs in a grid column.
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 = 'checkbox-selection';
}
if (!array_key_exists('value', $inputAttributes)) {
$value = $context->key;
}
$input = Html::checkbox($name, $value, $inputAttributes);
$content = $column->content === null
? $input
: ($column->content)($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) {
if (!$column->multiple) {
return null;
}
$header = Html::checkbox('checkbox-selection-all', 1);
}
return $cell
->addAttributes($column->headerAttributes)
->content($header);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.