You are here

protected function CampaignMonitorCampaign::createCampaignObj in Campaign Monitor 8

Create API campaign object.

Return value

mixed object CS_REST_Clients | FALSE The Campaign Monitor client object or FALSE on failure.

1 call to CampaignMonitorCampaign::createCampaignObj()
CampaignMonitorCampaign::createCampaign in modules/campaignmonitor_campaign/src/CampaignMonitorCampaign.php
Create a new campaign at the Campaign Monitor servers. The side-effect is that the local cache is cleared.

File

modules/campaignmonitor_campaign/src/CampaignMonitorCampaign.php, line 33

Class

CampaignMonitorCampaign

Namespace

Drupal\campaignmonitor_campaign

Code

protected function createCampaignObj() {
  if ($this->campaignMonitor
    ->libraryLoad(self::CampaignMonitorCAMPAIGN)) {

    // See http://drupal.stackexchange.com/questions/142247/how-to-autoload-classes-from-a-3rd-party-php-library-in-drupal-8
    return new \CS_REST_Campaigns($this->campaignMonitor->client_id, $this->campaignMonitor->api_key);
  }
  $this->campaignMonitor
    ->addError(WATCHDOG_ERROR, t('Failed to locate the client library.'));
  return FALSE;
}