You are here

function newsletter_block_view in Newsletter 7

Implements hook_block_view().

File

./newsletter.module, line 471
Defines menu items for newsletter administration, permissions and basic drupal hooks.

Code

function newsletter_block_view($delta = '') {
  switch ($delta) {
    case 'newsletter_subscribe':
      if (user_access('subscribe newsletters') && (!newsletter_is_subscribed() || variable_get('newsletter_always_show_subscribe_block', FALSE))) {
        newsletter_add_js();
        module_load_include('inc', 'newsletter', 'includes/newsletter.pages');
        $block['subject'] = t('Subscribe to our Newsletters');
        $block['content'][] = array(
          '#prefix' => '<div class="prefix">',
          '#markup' => check_plain(variable_get('newsletter_block_prefix')),
          '#suffix' => '</div>',
        );
        $block['content'][] = drupal_get_form('newsletter_subscribe_form');
        $block['content'][] = array(
          '#prefix' => '<div class="suffix">',
          '#markup' => check_plain(variable_get('newsletter_block_suffix')),
          '#suffix' => '</div>',
        );
      }
      else {
        $block = array();
      }
      break;
  }
  return $block;
}