Revision: 14999
Updated Code
at June 19, 2009 15:45 by psynaptic
Updated Code
<?php
function hook_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Block 1');
$blocks[1]['info'] = t('Block 2');
return $blocks;
case 'configure':
if ($delta == 0 && user_access('administer module')) {
$form['module_block_1'] = array();
}
if ($delta == 1 && user_access('administer module')) {
$form['module_block_2'] = array();
}
return $form;
case 'save':
if ($delta == 0) {
variable_set('module_block_setting_1', $edit['module_block_1']);
}
if ($delta == 1) {
variable_set('module_block_setting_2', $edit['module_block_2']);
}
break;
case 'view':
if ($delta == 0) {
$block['subject'] = t('Block 1 title');
$block['content'] = t('Block 1 content');
}
if ($delta == 1) {
$block['subject'] = t('Block 2 title');
$block['content'] = t('Block 2 content');
}
return $block;
}
}
Revision: 14998
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 19, 2009 15:44 by psynaptic
Initial Code
Initial URL
Initial Description
Initial Title
Drupal hook_block 6.x
Initial Tags
textmate, drupal
Initial Language
PHP