function messaging_debug_block in Messaging 6.3
Same name and namespace in other branches
- 6 messaging_debug/messaging_debug.module \messaging_debug_block()
- 6.2 messaging_debug/messaging_debug.module \messaging_debug_block()
Implementation of hook_block()
File
- messaging_debug/
messaging_debug.module, line 54 - Simple messaging using html page. Messaging method plug-in
Code
function messaging_debug_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Debug: Post message');
$blocks[1]['info'] = t('Debug: Message log');
return $blocks;
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Post message');
$block['content'] = drupal_get_form('messaging_debug_post_form');
return $block;
case 1:
if (!empty($_SESSION['messaging_debug_store'])) {
$block['subject'] = t('Message log');
foreach ($_SESSION['messaging_debug_store'] as $index => $message) {
list($text, $variables) = _messaging_debug_log_text($message);
$description = t($text, $variables);
$form[$index] = array(
'#type' => 'fieldset',
'#title' => truncate_utf8($description, 20),
'#description' => $description,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form[$index][] = array(
'#type' => 'item',
'#title' => t('Subject'),
'#value' => check_plain($message->subject),
);
$form[$index][] = array(
'#type' => 'item',
'#title' => t('Body'),
'#value' => check_plain($message->body),
);
}
$block['content'] = drupal_render($form);
unset($_SESSION['messaging_debug_store']);
return $block;
}
break;
}
break;
}
}