小编pee*_*ket的帖子

将表单与其他内容一起呈现到Drupal 7块中

我正在尝试在我的模块中渲染一个包含表单和链接列表的块.我可以正确地显示一个或另一个,但显然不能很好地理解渲染数组格式,以便在同一个块中同时渲染它们(一个在另一个之上).使用Drupal 7.4

设置块内容以显示列表的示例:

$block['subject']='Title';
$items= // code that generates a list of links into an array
$theme_args=array('items'=>$items,'type'=>'ul');
$block['content']=theme('item_list',$theme_args);
return $block;
Run Code Online (Sandbox Code Playgroud)

设置块内容以显示表单的示例:

$block['subject']='Title';
$block['content']=drupal_get_form('mymodule_myform_function'); 
// call function that returns the usual form array  
return $block;
Run Code Online (Sandbox Code Playgroud)

每个案例对我来说都很好.如何将表单和列表组合成一个块['content']数组,以便可以在一个块中呈现?提前致谢.

drupal-7 drupal-render drupal-modules

2
推荐指数
1
解决办法
5268
查看次数

标签 统计

drupal-7 ×1

drupal-modules ×1

drupal-render ×1