function simplenews_block_info in Simplenews 7
Same name and namespace in other branches
- 7.2 simplenews.module \simplenews_block_info()
Implements hook_block_info().
File
- ./
simplenews.module, line 1088 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_block_info() {
$blocks = array();
// Special block for multi
$blocks[0] = array(
'info' => t('Newsletter: Multi Subscription'),
);
// Only list a block if the newsletter is not 'hidden' and marked to provide a block.
foreach (simplenews_categories_load_multiple(array(), array(
'block' => '1',
'show_all' => FALSE,
)) as $category) {
//@todo 1. without form -> by role; 2. with form -> user caching with refresh on subscribe/unsubscribe (option as setting) or no caching
$blocks[$category->tid] = array(
'info' => t('Newsletter: @title', array(
'@title' => _simplenews_newsletter_name($category),
)),
// @todo Use block's own settings?
'cache' => variable_get('simplenews_block_f_' . $category->tid, 1) ? DRUPAL_NO_CACHE : DRUPAL_CACHE_PER_ROLE,
);
}
return $blocks;
}