You are here

function campaignmonitor_create_list in Campaign Monitor 8

1 call to campaignmonitor_create_list()
CampaignMonitorListCreateForm::validateForm in src/Form/CampaignMonitorListCreateForm.php
Create list validation form handler, which calls the API to create the list. This is done here to ensure better user feedback on failure.

File

./campaignmonitor.module, line 233
Module that plugs in Campaign Monitor functionality to your Drupal web site. For Campaign Monitor information see: http://www.campaignmonitor.com/.

Code

function campaignmonitor_create_list($values) {
  $cm = CampaignMonitor::getConnector();
  $result = $cm
    ->createList($values['listname'], $values['UnsubscribePage'], $values['ConfirmedOptIn'], $values['ConfirmationSuccessPage']);
  if (!$result) {
    $error = $cm
      ->getLatestError();
    return $error['message'];
    form_set_error('listname', $error['message']);
  }
  return 'success';
}