function simplenews_block_view in Simplenews 7.2
Same name and namespace in other branches
- 7 simplenews.module \simplenews_block_view()
Implements hook_block_view().
File
- ./
simplenews.module, line 1387 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_block_view($delta = '') {
// Special block for multi
if ($delta == 0) {
if (user_access('subscribe to newsletters')) {
module_load_include('inc', 'simplenews', 'includes/simplenews.subscription');
// render block only if permitted
$block = array(
'subject' => t('Newsletters'),
'content' => theme('simplenews_multi_block'),
);
return $block;
}
return NULL;
}
else {
$newsletters = simplenews_newsletter_get_visible(array(
'block' => '1',
));
// Only display a block if $delta is a valid newsletter id.
if (in_array($delta, array_keys($newsletters))) {
// $delta is validated, the block can be displayed.
$block = array(
'subject' => check_plain($newsletters[$delta]->name),
'content' => theme(array(
'simplenews_block__' . $delta,
'simplenews_block',
), array(
'newsletter_id' => $delta,
)),
);
return $block;
}
}
}