我想在另一个节点内显示一个节点.所以我检索第二个节点的节点ID,我想在另一个节点内渲染/打印/ ...它.
但我不知道该怎么做.我试过drupal_render,node_view,print,...但没有结果.有什么建议?
$nid = $node->field_linked_fiche['und'][0]['nid'];
$fullFiche = node_load($nid);
Run Code Online (Sandbox Code Playgroud)
编辑 - 整个模板
<?php
/**
* @file
* Bartik's theme implementation to display a single Drupal page.
*
...
*/
?>
<div id="page-wrapper"><div id="page">
<div id="header" class="<?php print $secondary_menu ? 'with-secondary-menu': 'without-secondary-menu'; ?>"><div class="section clearfix">
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>
<?php endif; ?>
<?php …Run Code Online (Sandbox Code Playgroud) 我尝试的形式打印Drupal的选择选项'元素.我觉得drupal_render不适用#default_value.每天的事情是确定的,除了#default_value不适用.
问题在哪里?有谁知道我怎么做到这一点?不#default_value接受string的价值?
这是我的代码伪:
function test_menu(){
$items=array();
$items['admin/config/regional/test']=array(
'title' => 'test',
'description' => t('test'),
'page callback' =>'drupal_get_form',
'page arguments' => array('test_function'),
);
$items[]=array();
return $items;
}
function test_function(){
$header = array
(
'test1' => t('test1'),
'test2'=> t('test2'),
);
$a=(1,2,3);
$$options=array();
foreach($a as $i=>$v)
{
$f['type'] = array(
'#type' => 'select',
'#options' => array(1,2,3,4),
'#default_value'=>1,
);
$options += array($name=>array( 'test1' => $v,
'test2'=> drupal_render($f['type']) ,
}
$form['table'] = array
(
'#type' => …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的模块中渲染一个包含表单和链接列表的块.我可以正确地显示一个或另一个,但显然不能很好地理解渲染数组格式,以便在同一个块中同时渲染它们(一个在另一个之上).使用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']数组,以便可以在一个块中呈现?提前致谢.