function services_resource_uri in Services 6.3
Same name and namespace in other branches
- 6.2 services.module \services_resource_uri()
- 7.3 includes/services.runtime.inc \services_resource_uri()
- 7 services.module \services_resource_uri()
Formats a resource uri using the formatter registered through services_set_server_info().
Parameters
array $path: An array of strings containing the component parts of the path to the resource.
Return value
string Returns the formatted resource uri, or NULL if no formatter has been registered.
8 calls to services_resource_uri()
- services_resource_build_index_list in ./
services.module - Helper function to build a list of items satisfying the index query.
- _comment_resource_create in resources/
comment_resource.inc - Adds a new comment to a node and returns the cid.
- _file_resource_create in resources/
file_resource.inc - Adds a new file and returns the fid.
- _file_resource_retrieve in resources/
file_resource.inc - Get a given file
- _node_resource_create in resources/
node_resource.inc - Creates a new node based on submitted values.
File
- ./
services.runtime.inc, line 253 - Contains functions that only are necessary when a service call is made. This has broken out so that this code isn't loaded for every page load.
Code
function services_resource_uri($path) {
//We need to use the alias if it exists.
$endpoint_name = services_get_server_info('endpoint');
$endpoint = services_endpoint_load($endpoint_name);
if (!empty($path[0]) && !empty($endpoint->resources[$path[0]]['alias'])) {
$path[0] = $endpoint->resources[$path[0]]['alias'];
}
$formatter = services_get_server_info('resource_uri_formatter');
if ($formatter) {
return call_user_func($formatter, $path);
}
return NULL;
}