function clients_connection_load_all in Web Service Clients 6.2
Same name and namespace in other branches
- 7.3 clients.module \clients_connection_load_all()
- 7.2 clients.module \clients_connection_load_all()
Load all connections.
This is a convenience wrapper around the CTools API.
Parameters
$types: (optional) Specify a single type or a list of types to include. If omitted, all are returned.
Return value
An array of connection objects, keyed by name.
4 calls to clients_connection_load_all()
- clients_connections_checkbox_options in ./
clients.module - FormAPI helper to get a list of clients for a checkboxes form element.
- clients_connections_list in ./
clients.connection.admin.inc - Page callback: list connections.
- clients_connections_select_options in ./
clients.module - FormAPI helper to get a list of clients for a select form element.
- clients_connection_form_validate in ./
clients.connection.admin.inc - Form validator handler for the connection form.
File
- ./
clients.module, line 332 - 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_connection_load_all($types = array()) {
if (!is_array($types)) {
$types = array(
$types,
);
}
ctools_include('export');
/*
// Once http://drupal.org/node/1161244 is fixed, we can pass a condition to
// CTools, as below:
if (count($types)) {
foreach ($types) {
$conditions['type']
}
dsm($types);
$connections = ctools_export_load_object('clients_connections', 'conditions');
//$placeholders = implode(',', array_fill(0, count($types), "'%s'"));
//$where = "WHERE type IN ($placeholders)";
}
else {
$connections = ctools_export_load_object('clients_connections', 'all');
}
*/
// ...but in the meantime we'll have to filter the list ourselves.
$connections = ctools_export_load_object('clients_connections', 'all');
if (count($types)) {
foreach ($connections as $connection_name => $connection) {
if (!in_array($connection->type, $types)) {
unset($connections[$connection_name]);
}
}
}
// We generally want connections ordered by machine name.
ksort($connections);
return $connections;
}