CoolCMS API

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

Methods

getOptions()

public getOptions() : array<int|string, string>
Return values
array<int|string, string>

setOptions()

public setOptions(array<int|string, string> $options) : static
Parameters
$options : array<int|string, string>

value => label

Return values
static

setUpdateProperty()

Property (database column) the new value is saved to.

public setUpdateProperty(string|null $updateProperty) : static
Parameters
$updateProperty : string|null
Return values
static

csvOptionLabel()

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
string

resolveOptionKey()

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
Return values
int|string|null
On this page

Search results