滚动
hook_block_info 的问题
论坛
您好!
我正在尝试通过编程创建区块。
在我的模块中这样做
function about_block_info(){
$blocks['about_company'] = array(
'info' => '关于公司',
'status' => TRUE,
'region' => '',
'weight' => 0,
'visibility' => 1,
'cache' => DRUPAL_NO_CACHE,
);
$blocks['first_red_text_item'] = array(
'info' => '红色区块第一列的弹出文本(主页)',
'status' => TRUE,
'region' => '',
'weight' => 0,
'visibility' => 1,
'cache' => DRUPAL_NO_CACHE,
);
return $blocks;
}
function about_block_configure($delta){
$form = array();
switch($delta){
case 'about_company':
$form['about_content_title'] = array(
'#type' => 'textfield',
'#title' => '主页区块标题',
'#size' => 15,
'#description' => '例如:“关于公司”',
'#default_value' => variable_get('about_company_title','关于公司'),
);
$form['about_content_text'] = array(
'#type' => 'textarea',
'#title' => '主页简短文本',
"#rows" => 5,
"#cols" => 20,
'#description' => '将作为主页的预览文本显示',
'#default_value' => variable_get('about_company_text','这是我们国家第一个正式注册的独立教育机构,当时还被称为苏联。它的目的是培养高水平的专业翻译人员,因为当时苏联没有类似的教育机构。'),
);
$form['address'] = array(
'#type' => 'textfield',
'#title' => '公司信息页面地址',
'#size' => 15,
'#description' => '例如:about',
'#default_value' => variable_get('about_company_address','about'),
);
break;
case 'first_red_text_item':
$form['first_red_text'] = array(
'#type' => 'textarea',
'#title' => '弹出区块的文本(第一列)',
"#rows" => 5,
"#cols" => 20,
'#description' => '弹出文本',
'#default_value' => variable_get('first_red_text1',''),
);
$form['first_red_text_address'] = array(
'#type' => 'textfield',
'#title' => '弹出文本所指向的页面地址',
'#size' => 15,
'#description' => '例如:about',
'#default_value' => variable_get('first_red_text_address1',''),
);
break;
}
return $form;
}
function about_block_save($delta = '', $edit = array()){
switch($delta){
case 'about_company':
variable_set('about_company_title',$edit['about_content_title']);
variable_set('about_company_text',$edit['about_content_text']);
variable_set('about_company_address',$edit['address']);
break;
case 'first_red_text_item':
variable_set('first_red_text1',$edit['first_red_text']);
variable_set('first_red_text_address1',$edit['first_red_text_address']);
break;
}
return;
}
:
所以在管理界面中,“关于公司”区块出现并且一切正常,而第二个区块却没有。错误在哪里?
- 登录 发表评论