function shoutbox_block in Shoutbox 5
Same name and namespace in other branches
- 6.2 shoutbox.module \shoutbox_block()
- 6 shoutbox.module \shoutbox_block()
Make the shout box block available. (Standard Drupal hook).
Parameters
$op: "list" to request list of blocks this module exposes; any other value to display the stock quotes block.
$delta: integer block selector (only recognizes 0 = stock quotes).
Return value
(if $op == "list") array containing list of blocks. (otherwise) HTML fragment for THE block.
File
- ./
shoutbox.module, line 105 - shoutbox module displays a block for users to create short messages for thw whole site. Uses AHAH to update the database and display content.
Code
function shoutbox_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]["info"] = t("Shoutbox");
return $blocks;
break;
case 'view':
$block = array();
drupal_add_css(drupal_get_path('module', 'shoutbox') . '/shoutbox.css');
switch ($delta) {
case 0:
if (user_access("access content")) {
// BUGBUG - why are we looking at $_GET
if (!stristr($_GET['q'], 'shoutbox')) {
// Bind submission to submit.
drupal_add_js(drupal_get_path('module', 'shoutbox') . '/shoutbox-form.js', 'module');
drupal_add_js(drupal_get_path('module', 'shoutbox') . '/form.js', 'module');
$block["subject"] = t("Shout Box");
$block["content"] = _shoutbox_block_view();
}
}
}
return $block;
break;
default:
break;
}
return;
}