function clients_get_connection in Web Service Clients 6.2
Same name and namespace in other branches
- 7 clients.module \clients_get_connection()
Load a connection object by id, which can then be used to make method calls.
This is mostly kept here for backwards compatibility with dependent modules which I don't have time to fix right now; however it does mean that those modules can't use connections stored in code (as they have no cid).
Usage: $client = clients_get_connection($cid); $client->callMethod('node.load', array(1));
Parameters
$cid: The id of a connection.
File
- ./
clients.module, line 277 - Clients module provides a UI, storage, and an API for handling connections to remote webservices, including those provided by Services module on other Drupal sites.
Code
function clients_get_connection($cid) {
ctools_include('export');
$result = ctools_export_load_object('clients_connections', 'conditions', array(
'cid' => $cid,
));
if (count($result)) {
// This is sort of going round the houses to get the right object class but it's simple.
$connection = array_pop($result);
$connection = clients_connection_load($connection->name);
}
return $connection;
}