function services_get_resource_api_version in Services 7.3
Returns currently set api version for an endpoint resource method.
Parameters
$endpoint: A fully loadded endpoint.
$resource: A resource name.
$method: A method name.
Return value
an array with the major and minor api versions
1 call to services_get_resource_api_version()
- services_request_apply_version in ./
services.module - Apply versions to the controller.
File
- ./
services.module, line 813 - Provides a generic but powerful API for web services.
Code
function services_get_resource_api_version($endpoint, $resource, $method) {
if (isset($endpoint->resources[$resource])) {
$class_info = services_operation_class_info();
foreach ($class_info as $class_name => $class) {
if (!empty($endpoint->resources[$resource][$class_name])) {
if (isset($endpoint->resources[$resource][$class_name][$method]['settings']['services']['resource_api_version'])) {
if ($version = _services_version_header_options()) {
$split = explode('.', $version);
}
else {
$split = explode('.', $endpoint->resources[$resource][$class_name][$method]['settings']['services']['resource_api_version']);
}
return array(
'major' => $split[0],
'minor' => $split[1],
);
}
}
}
}
}