function hook_health_api_callback_METHOD in Health Status 7
Allows you too create custom API callback handlers.
API requests are made to: health/api/METHOD The hook should return some custom format of the $data that is passed to it.
Parameters
array $data: All health result data.
Return value
string Returns a string to be rendered in a custom format.
4 functions implement hook_health_api_callback_METHOD()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- health_health_api_callback_json in ./
health.service.inc - Implements hook_health_api_callback_METHOD().
- health_health_api_callback_print_r in ./
health.service.inc - Implements hook_health_api_callback_METHOD().
- health_health_api_callback_var_export in ./
health.service.inc - Implements hook_health_api_callback_METHOD().
- health_health_api_callback_xml in ./
health.service.inc - Implements hook_health_api_callback_METHOD().
File
- ./
health.api.php, line 20 - This file contains examples and documentation of the various hooks you can use to add Health monitors to the Health Dashboard.
Code
function hook_health_api_callback_METHOD($data) {
// Will only return "error" or "okay" based on custom method.
foreach ($data as $groups) {
foreach ($groups as $check) {
if ($check['status'] == HEALTH_ERROR) {
// This check has an error, return "error".
return "error";
}
}
}
return "okay";
}