You are here

function mailchimp_block_view in Mailchimp 7

Implements hook_block_view(). Provides a block for each available list for a given user

File

./mailchimp.module, line 950
Mailchimp module.

Code

function mailchimp_block_view($delta = '') {
  global $user;
  $block = array();
  $lists = _mailchimp_get_available_lists($user);
  $list = isset($lists[$delta]) ? $lists[$delta] : array();
  if (!empty($list) && ($q = _mailchimp_get_api_object())) {
    $block['subject'] = t('Subscribe to @title', array(
      '@title' => $list->name,
    ));
    $block['content'] = drupal_get_form('mailchimp_subscribe_anon_form', $list, $q);
  }
  return $block;
}