function _simplenews_block in Simplenews 5
Helper function: generate block content before theming Collects data and applies access restriction
1 call to _simplenews_block()
- simplenews_block in ./
simplenews.module - Implementation of hook_block().
File
- ./
simplenews.module, line 718
Code
function _simplenews_block($tid) {
global $user;
$block = array();
$recent = simplenews_recent_newsletters($tid, variable_get('simplenews_block_i_' . $tid, 5));
$block['subscribed'] = simplenews_user_is_subscribed($user->mail, $tid) == TRUE;
$block['user'] = !empty($user->uid);
$block['tid'] = $tid;
$block['message'] = check_plain(variable_get('simplenews_block_m_' . $tid, t('Stay informed on our latest news!')));
if (user_access('subscribe to newsletters')) {
$block['form'] = drupal_get_form('simplenews_block_form_' . $tid);
$block['subscription-link'] = l(t('Manage my subscriptions'), 'newsletter/subscriptions');
}
if (user_access('view links in block') || user_access('administer newsletters')) {
$block['newsletter-link'] = l(t('Previous issues'), 'taxonomy/term/' . $tid);
$block['itemlist'] = theme('item_list', $recent, t('Previous issues'), 'ul');
$block['rssfeed'] = theme('feed_icon', url('taxonomy/term/' . $tid . '/0/feed'));
}
return $block;
}