public function CampaignMonitorManager::getListDetails in Campaign Monitor 8.2
Gets list details from Campaign Monitor.
This information is retrieved from the local cache and may be outdated. It fetches the unsubscribe link, confirmation success page and confirmed opt-in options.
Parameters
string $listId: The Campaign Monitor list ID.
Return value
mixed|array|false An array with the information or FALSE on failure.
2 calls to CampaignMonitorManager::getListDetails()
- CampaignMonitorManager::getExtendedList in src/
CampaignMonitorManager.php - Get all information available about a given list.
- CampaignMonitorManager::updateList in src/
CampaignMonitorManager.php - Update remote list information.
File
- src/
CampaignMonitorManager.php, line 397
Class
- CampaignMonitorManager
- Manager for Campaignmonitor.
Namespace
Drupal\campaignmonitorCode
public function getListDetails($listId) {
// If 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[$listId])) {
$this
->addError($this
->t('Unknown list id @listID.', [
'@listID' => $listId,
]));
return FALSE;
}
// If list details are not set, create list object and fetch the information
// from the Campaign Monitor servers.
if (!isset($this->lists[$listId]['details'])) {
if ($obj = $this
->createListObj($listId)) {
$result = $obj
->get();
if ($result
->was_successful()) {
// Convert the return object into a keyed array.
$this->lists[$listId]['details'] = [];
foreach ($result->response as $key => $value) {
if (!in_array($key, [
'ListID',
'Title',
])) {
$this->lists[$listId]['details'][$key] = $value;
}
}
// Update the cache with list details.
$this->cacheBackend
->set('campaignmonitor_lists', $this->lists);
}
else {
$this
->addError($result->response->Message, $result->http_status_code);
return FALSE;
}
}
else {
return FALSE;
}
}
return $this->lists[$listId]['details'];
}