You are here

function clients_connection_unpack_object in Web Service Clients 6.2

Same name and namespace in other branches
  1. 7.2 clients.module \clients_connection_unpack_object()

CTools object factory: unpacks the data from CTools into the right class.

Parameters

$schema: The schema from drupal_get_schema().

$data: The data as loaded by db_fetch_object().

1 string reference to 'clients_connection_unpack_object'
clients_schema in ./clients.install
Implementation of hook_schema

File

./clients.module, line 377
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_unpack_object($schema, $data) {
  $type = $data->type;
  $class = 'clients_connection_' . $type;

  // Handle missing classes. Note that class_exists() works with autoloading!
  if (!class_exists($class)) {
    $class = 'clients_connection_broken';
    $data->broken_message = t('The class for this connection is missing. Perhaps the module providing this is not available?');
  }

  // The connection's __construct() takes over from here.
  $object = new $class($data);
  return $object;
}