function farm_api_restws_response_alter in farmOS 7
Implements hook_restws_response_alter().
File
- modules/
farm/ farm_api/ farm_api.module, line 514 - Farm API module.
Code
function farm_api_restws_response_alter(&$response, $function, $formatName, $resourceController) {
// If the format is not JSON, bail.
if ($formatName != 'json') {
return;
}
// If the response contains a list of entities, iterate through them and
// pass each to farm_api_restws_response_alter_item().
if (!empty($response['list'])) {
foreach ($response['list'] as &$item) {
farm_api_restws_response_alter_item($item);
}
}
else {
farm_api_restws_response_alter_item($response);
}
}