You are here

public static function CampaignMonitor::getConnector in Campaign Monitor 8

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.

string $libraryPath: A string containing the path to the Campaign Monitor API library.

Return value

object CampaignMonitor The CampaignMonitor singleton object.

14 calls to CampaignMonitor::getConnector()
campaignmonitor_cache_clear_subscriber in ./campaignmonitor.module
Clears a campaignmonitor user subscriber from cache.
campaignmonitor_campaign_get_campaigns in modules/campaignmonitor_campaign/campaignmonitor_campaign.module
campaignmonitor_campaign_get_drafts in modules/campaignmonitor_campaign/campaignmonitor_campaign.module
Helper function to get Draft campaigns (not sent yet)
campaignmonitor_create_list in ./campaignmonitor.module
campaignmonitor_delete_list in ./campaignmonitor.module

... See full list

File

src/CampaignMonitor.php, line 188
Implementation of the CampaignMonitor class, which is a wrapper class for Campaign Monitor v3 API. It's implemented as a Singleton class and instances are created using the account variables and the static function getConnector(). An example:.

Class

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;
}