HasLabelsTrait
trait HasLabelsTrait
Methods
Provides a default has_labels config option.
Generates key => value pairs to map database-saved keys to displayed labels for form fields
(e.g. in select dropdowns), if field has labels.
Replaces all keys with the according labels in the property's value.
Returns whether the field is configured to use labels.
Parses the property's values string into an array with key => value pairs,
for example: "key1=label1;key2=label2" becomes ['key1' => 'label1', 'key2' => 'label2'].
Details
at line 17
static array
getConfigFields()
Provides a default has_labels config option.
at line 38
static array
getEditFDL(Controller $mod, array $field, Form $form, int $profileId, int $copyId, array $config)
Generates key => value pairs to map database-saved keys to displayed labels for form fields
(e.g. in select dropdowns), if field has labels.
at line 116
static string
getValueLabels(string|null $propertyConfig, string $propertyValues, string $propertyValue, string $glue = '; ')
Replaces all keys with the according labels in the property's value.
The key=value pairs are generated from all possible values of the property.
Handles also multiple values, e.g. for Checkbox.
at line 70
static bool
hasLabels(string|null $propertyConfig)
Returns whether the field is configured to use labels.
The $propertyConfig string is parsed into an array and checked for the has_labels key.
at line 85
static array
parseLabeledValues(string|null $propertyConfig, string $propertyValues)
Parses the property's values string into an array with key => value pairs,
for example: "key1=label1;key2=label2" becomes ['key1' => 'label1', 'key2' => 'label2'].