You are here

public static function CampaignMonitorManager::getConnector in Campaign Monitor 8.2

Implements a singleton pattern that returns an instance of this object.

The function requires Campaign Monitor account keys to create the connection. These keys can be found at the Campaign Monitor homepage and should be entered in the administration interface. The object can then be created like this:.

<?php $account = variable_get('campaignmonitor_account', array()); $cm = CampaignMonitor::getConnector($account['api_key'], $account['client_id']); ?>

Parameters

string $api_key: The Campaign Monitor API key.

string $client_key: The Campaign Monitor client key.

Return value

object The CampaignMonitor singleton object.

File

src/CampaignMonitorManager.php, line 264

Class

CampaignMonitorManager
Manager for Campaignmonitor.

Namespace

Drupal\campaignmonitor

Code

public static function getConnector($api_key = FALSE, $client_key = FALSE) {
  if ($api_key && $client_key || !isset(self::$instance)) {
    $class = __CLASS__;
    self::$instance = new $class($api_key, $client_key);
  }
  return self::$instance;
}