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