2013-09-26 58 views
1

我的工作中,我需要绘制多个节点添加表单模块上,从不同的内容类型,在同一个页面,并将其保存一次全部。我有我需要添加的每个节点的所有内容类型,我甚至设法使用field_info_instances("node", $type)来获取字段。的Drupal 7:如何绘制所有控件的节点添加表单动态

现在我需要呈现的字段。我找到node_add(),但是这个函数创建了整个表单,包括保存按钮和发布选项。我只需要这些字段的小部件。

有钩子或在Drupal的功能,将仅呈现小部件对于给定的内容类型,或者一个领域甚至小部件节点添加形式给出它的信息?

R.

PS:我正在Drupal的7.x的

回答

0

调用node_add($ CONTENT_TYPE);将为您提供此特定表单类型的节点添加表单。

我倒是觉得这样

$form = array(); 
$types = array('page', 'blog', 'article'); 

foreach ($types as $type) { 
    $type_form = node_add($type); 

    // Somehow merge this data with the $form array avoiding the conflicts 
    // resulting from mulitple fields with same name. 

    // and find a way to submit all of them with one button .. ajax? 
} 

return $form;