protected function Dropdown::allowedValuesString in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.2 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.3 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.4 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.5 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.6 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.7 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 8.8 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 10.3.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 10.0.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 10.1.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::allowedValuesString()
- 10.2.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::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 Dropdown::allowedValuesString()
- Dropdown::storageSettingsForm in modules/
custom/ dropdown/ src/ Plugin/ Field/ FieldType/ Dropdown.php - Returns a form for the storage-level settings.
File
- modules/
custom/ dropdown/ src/ Plugin/ Field/ FieldType/ Dropdown.php, line 147
Class
- Dropdown
- Plugin implementation of the 'dropdown' field type.
Namespace
Drupal\dropdown\Plugin\Field\FieldTypeCode
protected function allowedValuesString(array $values) {
$lines = [];
foreach ($values as $key => $value) {
if (is_array($value)) {
$lines[$key] = implode("|", $value);
}
}
return implode("\n", $lines);
}