You are here

function clients_connection_load in Web Service Clients 6.2

Same name and namespace in other branches
  1. 6 clients.module \clients_connection_load()
  2. 7.3 clients.module \clients_connection_load()
  3. 7 clients.module \clients_connection_load()
  4. 7.2 clients.module \clients_connection_load()

Load a connection object which can then be used to make method calls.

Used as a menu loader. CTools has static caching so it's okay that we come here tons of times on a single page load in our admin section.

Parameters

$name: A connection machine name.

Return value

A fully loaded connection handler object. If there is a problem, such as the machine name or connection type not existing, a connection of class 'clients_connection_broken' is returned.

2 calls to clients_connection_load()
clients_connection_call in ./clients.module
Call a remote method on a client.
clients_get_connection in ./clients.module
Load a connection object by id, which can then be used to make method calls.

File

./clients.module, line 302
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($name) {
  ctools_include('export');
  $result = ctools_export_load_object('clients_connections', 'names', array(
    $name,
  ));
  if (isset($result[$name])) {
    $connection = $result[$name];

    // new $class($result[$name]);
    return $connection;
  }
  else {
    $connection = array(
      'name' => $name,
      'broken_message' => t('Client connection %name not found.', array(
        '%name' => $name,
      )),
    );
    return new clients_connection_broken($connection);
  }
}