BoolRenderer
extends CellRenderer
in package
Yes/no boolean badge (the cell template resolves the translations `admin.general.yes/no`).
Table of Contents
Methods
- __construct() : mixed
- create() : static
- getTemplateName() : string
- Cell template name (`Cells/<type>.latte`).
- prepare() : array<string, mixed>
- Variables for the cell template.
- toCsvValue() : string
- The `prepare()` vars have no `text` key; the CSV export translates directly via the shared `admin.general.yes/no`.
- toScalarValue() : mixed
- Column value to a scalar comparable with the keys of `options` maps: a `BackedEnum` becomes its `value`, a pure enum its `name`, a bool 0/1. Other values pass unchanged.
- toString() : string
- Column value (mixed) to text; non-stringable values give an empty string.
Methods
__construct()
public
final __construct() : mixed
create()
public
static create() : static
Return values
staticgetTemplateName()
Cell template name (`Cells/<type>.latte`).
public
getTemplateName() : string
Return values
stringprepare()
Variables for the cell template.
public
prepare(mixed $value, object $entity, DataGrid $grid, BaseColumn $column) : array<string, mixed>
Parameters
- $value : mixed
- $entity : object
- $grid : DataGrid
- $column : BaseColumn
Return values
array<string, mixed>toCsvValue()
The `prepare()` vars have no `text` key; the CSV export translates directly via the shared `admin.general.yes/no`.
public
toCsvValue(mixed $value, object $entity, DataGrid $grid, BaseColumn $column) : string
Parameters
- $value : mixed
- $entity : object
- $grid : DataGrid
- $column : BaseColumn
Return values
stringtoScalarValue()
Column value to a scalar comparable with the keys of `options` maps: a `BackedEnum` becomes its `value`, a pure enum its `name`, a bool 0/1. Other values pass unchanged.
protected
toScalarValue(mixed $value) : mixed
IMPORTANT: entities return an enum object for enum columns (typed property), so without
this normalization the cell template receives an object and (string) $enum is a fatal
error, not an empty output.
Parameters
- $value : mixed
toString()
Column value (mixed) to text; non-stringable values give an empty string.
protected
toString(mixed $value) : string
An enum prints its value/name; a bool keeps the (string) semantics
(false is empty, not "0"), as the admin always printed it.
Parameters
- $value : mixed