function services_get_all_resources in Services 6.2
Same name and namespace in other branches
- 7 services.module \services_get_all_resources()
Gets all resource definitions.
Return value
array An array containing all resources.
1 call to services_get_all_resources()
- services_get_all in ./
services.module - Get all service definitions
File
- ./
services.module, line 513 - Provides a generic but powerful API for exposing web services.
Code
function services_get_all_resources($include_services = TRUE, $reset = FALSE) {
$cache_key = 'services:resources' . ($include_services ? '_with_services' : '');
if (!$reset && ($cache = cache_get($cache_key)) && isset($cache->data)) {
return $cache->data;
}
else {
$resources = module_invoke_all('service_resource');
drupal_alter('service_resources', $resources);
services_strip_hashes($resources);
$controllers = array();
services_process_resources($resources, $controllers);
foreach ($controllers as &$controller) {
if (!isset($controller['access callback'])) {
$controller['access callback'] = 'user_access';
}
if (!isset($controller['auth'])) {
$controller['auth'] = TRUE;
}
if (!isset($controller['key'])) {
$controller['key'] = TRUE;
}
}
drupal_alter('service_resources_post_processing', $resources);
services_auth_invoke('alter_methods', $controllers);
if ($include_services) {
$services = services_get_all(FALSE);
// Include the file that has the necessary functions for translating
// methods to resources.
if (!empty($services)) {
module_load_include('inc', 'services', 'services.resource-translation');
$resources = array_merge(_services_services_as_resources($services), $resources);
}
}
cache_set($cache_key, $resources);
return $resources;
}
}