function messaging_devel_block in Messaging 7
Implementation of hook_block()
File
- messaging_devel/
messaging_devel.module, line 45 - Simple messaging using html page. Messaging method plug-in
Code
function messaging_devel_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:
module_load_include('admin.inc', 'messaging');
$block['subject'] = t('Post message');
$block['content'] = drupal_get_form('messaging_admin_test_post_form');
return $block;
case 1:
if ($messages = messaging_devel_store_msg()) {
$block['subject'] = t('Message log');
foreach ($messages as $index => $message) {
list($text, $variables) = _messaging_devel_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);
return $block;
}
break;
}
break;
}
}