function heartbeat_block_view in Heartbeat 7
Implements hook_block_view().
File
- ./
heartbeat.module, line 332 - Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.
Code
function heartbeat_block_view($delta = '') {
if ($delta == 'heartbeat_active_users') {
$block['subject'] = t('Most active users');
$block['content'] = drupal_render(heartbeat_api_most_active_users(variable_get('heartbeat_active_users', 'default')));
return $block;
}
// For blocks calling this page in general.
$account = NULL;
if (variable_get('heartbeat_show_user_profile_messages_' . $delta, 0) && arg(0) == 'user' && is_numeric(arg(1))) {
$account = user_load(arg(1));
}
if ($heartbeatStream = heartbeat_stream($delta, FALSE, $account)) {
if (variable_get('exclude_og_' . $delta, 0)) {
$heartbeatStream
->excludeOg(TRUE);
}
heartbeat_stream_build($heartbeatStream);
$block_content = heartbeat_stream_view($heartbeatStream, $heartbeatStream->config->block_view_mode);
if (!empty($block_content)) {
$content = array();
$content['#theme'] = 'heartbeat_list';
$content['#stream'] = $heartbeatStream;
$content['#content'] = $block_content;
$content['#attached']['js'][] = drupal_get_path('module', 'heartbeat') . '/js/heartbeat.js';
if (variable_get('heartbeat_include_default_style', 1)) {
$content['#attached']['css'][] = drupal_get_path('module', 'heartbeat') . '/css/heartbeat.css';
}
// Dirty hack to fix polled streams when no js/css can be included on custom ajax command.
$content['#attached']['css'][] = drupal_get_path('module', 'heartbeat') . '/layouts/heartbeat_2col/heartbeat_2col.css';
$block['content'] = $content;
}
$block['subject'] = t($heartbeatStream->config->title);
}
else {
return NULL;
}
return $block;
}