function hook_restws_response_alter in RESTful Web Services 7.2
Alter the outgoing response.
Parameters
mixed $response: The response data being returned by the REST service (not yet serialized).
string $function: The function being called on the REST service.
string $format: The name of the format serializing the response.
RestWSResourceControllerInterface $resourceController: The resource controller.
Related topics
9 invocations of hook_restws_response_alter()
- RestWSBaseFormat::createResource in ./
restws.formats.inc - Creates a new resource.
- RestWSBaseFormat::deleteResource in ./
restws.formats.inc - Deletes a resource.
- RestWSBaseFormat::queryResource in ./
restws.formats.inc - Implements RestWSFormatInterface::queryResource().
- RestWSBaseFormat::updateResource in ./
restws.formats.inc - Updates a resource.
- RestWSBaseFormat::viewResource in ./
restws.formats.inc - Gets the representation of a resource.
File
- ./
restws.api.php, line 143 - This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
Code
function hook_restws_response_alter(&$response, $function, $formatName, $resourceController) {
if ($function == 'viewResource' && $formatName == 'json') {
$response['site_name'] = variable_get('site_name', '');
}
}