You are here

function campaignmonitor_block_info in Campaign Monitor 7

Implements hook_block_info().

File

./campaignmonitor.module, line 149
Module that plugs in Campaign Monitor functionality to your Drupal web site.

Code

function campaignmonitor_block_info() {
  $blocks = array();
  $account = variable_get('campaignmonitor_account', FALSE);
  if ($account) {

    // Create a block for each list.
    $lists = CampaignMonitor::getConnector()
      ->getLists();
    if ($lists) {
      foreach ($lists as $list_id => $list) {

        // Get local configuration options and check if the list is enabled.
        if (campaignmonitor_is_list_enabled($list_id)) {
          $blocks[$list_id] = array(
            'info' => t('Subscribe to @list_name (Campaign Monitor)', array(
              '@list_name' => $list['name'],
            )),
          );
        }
      }
    }
    $settings = variable_get('campaignmonitor_general', FALSE);
    if ($settings && isset($settings['archive'])) {
      $blocks[CAMPAIGNMONITOR_ARCHIVE_DELTA] = array(
        'info' => t('Campaign monitor newsletter archive'),
      );
    }
  }
  return $blocks;
}