You are here

function services_client_connection_get_plugin in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client_connection/services_client_connection.module \services_client_connection_get_plugin()

Create new plugin instance

Parameters

$type: Plugin type

$name: Name of required plugin

$connection: Connection object

$config: Plugin configuration

$client: Optinally client object

Return value

ServicesClientConnectionPlugin

2 calls to services_client_connection_get_plugin()
ServicesClientConnection::getPlugin in services_client_connection/include/connection.inc
Loads required class, initialized object by connection configuration.
services_client_connection_plugin_config in services_client_connection/plugins/export_ui/services_client_connection_ui.class.php
Plugin configuration form

File

services_client_connection/services_client_connection.module, line 130
Services Client Connection allows to configure different connections via UI and store them as exportable configuration. API client should be able to communicate with different versions of remote Services module via unified API client.

Code

function services_client_connection_get_plugin($type, $name, $connection, $config, $client = NULL) {

  // If plugin name isn't defined load default base plugin class to prevent PHP errors
  if (empty($name)) {
    $class = services_client_connection_get_plugin_default($type);
  }
  else {
    $class = ctools_plugin_load_class('services_client_connection', $type, $name, 'handler');
  }
  if ($class) {
    return new $class($connection, $config, $client);
  }
  else {
    throw new ServicesClientConnectionException(t('Missing class @name', array(
      '@name' => $name,
    )));
  }
}