hook_block() 用于为自己的模块添加一系列区块。
<?php
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0] = array(
'info' => t('My Module Block'),
);
return $blocks;
}
elseif ($op == 'view') {
switch ($delta) {
case 0:
$block = array(
'subject' => t('My Block'),
'content' => "My Block Content",
);
break;
}
return $block;
}
}
?>