You are here

function campaignmonitor_get_lists in Campaign Monitor 8

Returns all CampaignMonitor lists for a given key. Lists are stored in the cache.

Parameters

array $list_ids: An array of list IDs to filter the results by.

bool $reset: Force a cache reset.

Return value

array An array of list data arrays.

17 calls to campaignmonitor_get_lists()
CampaignMonitorIcsForm::submitForm in modules/campaignmonitor_ics/src/Form/CampaignMonitorIcsForm.php
Form submission handler.
CampaignMonitorIcsForm::userSelectSubscribeForm in modules/campaignmonitor_ics/src/Form/CampaignMonitorIcsForm.php
CampaignMonitorListsController::overview in src/Controller/CampaignMonitorListsController.php
CampaignMonitorSubscribeBlock::blockForm in src/Plugin/Block/CampaignMonitorSubscribeBlock.php
Returns the configuration form elements specific to this block plugin.
CampaignMonitorSubscribeForm::submitForm in src/Form/CampaignMonitorSubscribeForm.php
Form submission handler.

... See full list

File

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

Code

function campaignmonitor_get_lists($list_ids = [], $reset = FALSE) {
  $cm = CampaignMonitor::getConnector();
  $lists = $cm
    ->getLists();

  // Filter by given IDs.
  if (!empty($list_ids)) {
    $filtered_lists = [];
    foreach ($list_ids as $id) {
      if (array_key_exists($id, $lists)) {
        $filtered_lists[$id] = $lists[$id];
      }
    }
    return $filtered_lists;
  }
  else {
    return $lists;
  }
}