function ListItemBase::allowedValuesString
Same name in other branches
- 9 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::allowedValuesString()
- 10 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::allowedValuesString()
- 11.x core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::allowedValuesString()
Generates a string representation of an array of 'allowed values'.
This string format is suitable for edition in a textarea.
Parameters
array $values: An array of values, where array keys are values and array values are labels.
Return value
string The string representation of the $values array:
- Values are separated by a carriage return.
- Each value is in the format "value|label" or "value".
1 call to ListItemBase::allowedValuesString()
- ListItemBase::storageSettingsForm in core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListItemBase.php - Returns a form for the storage-level settings.
File
-
core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListItemBase.php, line 241
Class
- ListItemBase
- Plugin base class inherited by the options field types.
Namespace
Drupal\options\Plugin\Field\FieldTypeCode
protected function allowedValuesString($values) {
$lines = [];
foreach ($values as $key => $value) {
$lines[] = "{$key}|{$value}";
}
return implode("\n", $lines);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.