protected static function OptionsEmailItem::structureAllowedValues in Contact Storage 8
Creates a structured array of allowed values from a key-value array.
Parameters
array $values: Allowed values were the array key is the 'value' value, the value is the 'label' value.
Return value
array Array of items with a 'value' and 'label' key each for the allowed values.
Overrides ListItemBase::structureAllowedValues
See also
\Drupal\options\Plugin\Field\FieldType\ListItemBase::simplifyAllowedValues()
File
- src/
Plugin/ Field/ FieldType/ OptionsEmailItem.php, line 121
Class
- OptionsEmailItem
- Plugin to add the Option email item custom field type.
Namespace
Drupal\contact_storage\Plugin\Field\FieldTypeCode
protected static function structureAllowedValues(array $values) {
$structured_values = [];
foreach ($values as $key => $value) {
$structured_values[] = [
'key' => $key,
'value' => $value['value'],
'emails' => $value['emails'],
];
}
return $structured_values;
}