You are here

public function CampaignMonitor::getExtendedList in Campaign Monitor 7

Get all information available about a given list.

This is done by calling getLists(), getListDetails() and getCustomFields(), hence building the local list cache.

Parameters

string $list_id: The Campaign Monitor list ID.

Return value

array|bool An array containing the list information or FALSE on failure.

File

lib/campaignmonitor.class.inc, line 537
Implementation of the CampaignMonitor class.

Class

CampaignMonitor
Implementation of the CampaignMonitor class.

Code

public function getExtendedList($list_id) {

  // If the lists have not been loaded yet, get them as they build the basic
  // cache.
  if (empty($this->lists)) {
    $this
      ->getLists();
  }

  // Test that the listId is valid.
  if (!isset($this->lists[$list_id])) {
    $this
      ->addError(WATCHDOG_ERROR, t('Unknown list id @listID.', [
      '@listID' => $list_id,
    ]));
    return FALSE;
  }

  // Load list details and custom fields (using is_array() since
  // getCustomFields() may return an empty array).
  if (!$this
    ->getListDetails($list_id) || !is_array($this
    ->getCustomFields($list_id))) {
    $this
      ->addError(WATCHDOG_ERROR, t('Could not retrieve extended information for @listID.', [
      '@listID' => $list_id,
    ]));
    return FALSE;
  }
  return $this->lists[$list_id];
}