InlineEditableTrait
Shared support of inline editable renderers ({@see InlineEditableRenderer}): the `value => label` map and the target property for saving.
Without an explicit setUpdateProperty() the first property of the column is updated.
Table of Contents
Properties
- $options : array<int|string, string>
- $updateProperty : string|null
Methods
- getOptions() : array<int|string, string>
- getUpdateProperty() : string
- setOptions() : static
- setUpdateProperty() : static
- Property (database column) the new value is saved to.
- csvOptionLabel() : string
- Label of the current value for the CSV export. {@see SelectRenderer} / {@see ToggleRenderer} have no plain `text` key in the `prepare()` vars (options/current, label/variant for the switch UI), so their `toCsvValue()` uses this instead of the default from {@see CellRenderer}.
- resolveOptionKey() : int|string|null
- Key in options matching the current value (compared as strings because of int vs. string keys), or null when the value is not among the options.
Properties
$options
protected
array<int|string, string>
$options
= []
value => label
$updateProperty
protected
string|null
$updateProperty
= null
Methods
getOptions()
public
getOptions() : array<int|string, string>
Return values
array<int|string, string>getUpdateProperty()
public
getUpdateProperty(BaseColumn $column) : string
Parameters
- $column : BaseColumn
Return values
stringsetOptions()
public
setOptions(array<int|string, string> $options) : static
Parameters
- $options : array<int|string, string>
-
value => label
Return values
staticsetUpdateProperty()
Property (database column) the new value is saved to.
public
setUpdateProperty(string|null $updateProperty) : static
Parameters
- $updateProperty : string|null
Return values
staticcsvOptionLabel()
Label of the current value for the CSV export. {@see SelectRenderer} / {@see ToggleRenderer} have no plain `text` key in the `prepare()` vars (options/current, label/variant for the switch UI), so their `toCsvValue()` uses this instead of the default from {@see CellRenderer}.
protected
csvOptionLabel(mixed $value) : string
Parameters
- $value : mixed
Return values
stringresolveOptionKey()
Key in options matching the current value (compared as strings because of int vs. string keys), or null when the value is not among the options.
protected
resolveOptionKey(mixed $value) : int|string|null
Parameters
- $value : mixed