function _services_services_as_resources in Services 6.2
Same name and namespace in other branches
- 7 services.resource-translation.inc \_services_services_as_resources()
Turns an array of services methods into resources where all methods are added as actions. A 'menu.get'-method would be added as a 'get'-action on the resource 'service_menu'.
Parameters
array $services: An array of service methods.
Return value
array An array of resource definitions.
1 call to _services_services_as_resources()
- services_get_all_resources in ./
services.module - Gets all resource definitions.
File
- ./
services.resource-translation.inc, line 83 - Contains the necessary functionality for translating resources to services methods and vice versa.
Code
function _services_services_as_resources($services) {
$resources = array();
foreach ($services as $service) {
$signature = preg_split('/\\./', $service['method']);
$controller = $service;
$controller['args'] = array();
foreach ($service['args'] as $arg) {
$arg['source'] = array(
'data' => $arg['name'],
);
$controller['args'][] = $arg;
}
$resources['service_' . $signature[0]]['actions'][$signature[1]] = $controller;
}
return $resources;
}