You are here

public function CampaignMonitorManager::deleteList in Campaign Monitor 8.2

Delete a list from Campaign Monitor.

This action can not be reverted. The list is also removed from the local cache.

Parameters

mixed $listId: The Campaign Monitor list ID.

Return value

bool TRUE on success, FALSE otherwise.

File

src/CampaignMonitorManager.php, line 693

Class

CampaignMonitorManager
Manager for Campaignmonitor.

Namespace

Drupal\campaignmonitor

Code

public function deleteList($listId) {
  if ($obj = $this
    ->createListObj($listId)) {
    $result = $obj
      ->delete();
    if ($result
      ->was_successful()) {
      unset($this->lists[$listId]);
      $this->cacheBackend
        ->set('campaignmonitor_lists', $this->lists, $this
        ->getCacheTimeout());
      return TRUE;
    }
    else {
      $this
        ->addError($result->response->Message, $result->http_status_code);
      return FALSE;
    }
  }
  return FALSE;
}