public function ServicesClientFieldFormatter::format in Services Client 7.2
Format source value to destination.
Parameters
ServicesClientMappingValue $source: Source value gathered from Reader.
Return value
array Value specified by 'key' => 'name', 'value' => 'mixed'
Overrides ServicesClientMappingFormatterInterface::format
File
- include/
mapping.inc, line 727
Class
Code
public function format(ServicesClientMappingValue $source) {
// Handle empty values
if ($source
->isEmpty()) {
return $this
->formatEmptyValue();
}
// If single value is forced.
$values = $source
->getValue();
if ($this->config['multivalue'] == 'force_single') {
$values = array(
reset($values),
);
}
return $this
->formatArray($values);
}