function notifications_ui_block in Notifications 6.2
Same name and namespace in other branches
- 5 notifications_ui/notifications_ui.module \notifications_ui_block()
- 6.4 notifications_ui/notifications_ui.module \notifications_ui_block()
- 6 notifications_ui/notifications_ui.module \notifications_ui_block()
- 6.3 notifications_ui/notifications_ui.module \notifications_ui_block()
Implementation of hook_block()
File
- notifications_ui/
notifications_ui.module, line 494 - User Interface for subscriptions modules
Code
function notifications_ui_block($op = 'list', $delta = 0) {
global $user;
if ($op == 'list') {
$blocks[0]['info'] = t('Subscriptions');
$blocks[0]['cache'] = BLOCK_NO_CACHE;
return $blocks;
}
else {
if ($op == 'view') {
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1))) && notifications_ui_node_options($node->type, 'block')) {
// Only display if we have something for the form
if ($node_options = notifications_ui_subscribe_options($user, 'node', $node)) {
$block['subject'] = t('Subscriptions');
$block['content'] = drupal_get_form('notifications_ui_options_form', $node_options, FALSE);
return $block;
}
}
elseif (arg(0) == 'user' && is_numeric(arg(1)) && notifications_ui_account_options('block')) {
// Only display if we have something for the form
if (($account = user_load(arg(1))) && ($options = notifications_ui_subscribe_options($user, 'user', $account))) {
$block['subject'] = t('Subscriptions');
$block['content'] = drupal_get_form('notifications_ui_options_form', $options, FALSE);
return $block;
}
}
}
}
}