Controller
in package
Base class for all controllers. Controllers should inherit from this class.
Table of Contents
- makeCEDFood() : string
- Makes food edible for CED fields
- makeFood() : string
- Makes food edible for input selects
Methods
makeCEDFood()
Makes food edible for CED fields
public
makeCEDFood(array<string|int, mixed> $table, array<string|int, mixed> $fields[, callable|null $escape = null ]) : string
Parameters
- $table : array<string|int, mixed>
-
Table
- $fields : array<string|int, mixed>
-
Fields of the array to get to the client
- $escape : callable|null = null
-
Optional callable($value, $field) returning the escaped value; without it values are output unescaped
Return values
string —JS array literal (not valid JSON, trailing commas) with one object per row; every row needs an 'id' (output as 'dbId')
makeFood()
Makes food edible for input selects
public
makeFood(array<string|int, mixed> $table, string $valueField, string $textField[, string|null $optionalTextField = null ]) : string
Parameters
- $table : array<string|int, mixed>
-
Database table result
- $valueField : string
-
Column key that is used as value
- $textField : string
-
Column key that is shown to the client as text
- $optionalTextField : string|null = null
-
Column key appended to the text with a space
Return values
string —JSON-encoded list of value/text pairs