我正在重构一些代码是我在某个时代编写的 Drupal 模块。为了让其他人使用它,我正在添加一个配置页面。
我已经成功定义了一个字段集,但我不知道如何向其中“插入”内容。以下代码为我站点上定义的每种节点类型设置无线电:
$node_types = node_get_types('names');
$test = array(
'#title' => t('tweeting node'),
'#type' => 'radios',
'#options' => $node_types,
'#default_value' => 'Page',
'#weight' => 0,
);
以下定义了我要插入上面生成的单选按钮的字段集:
$form['twitterhelper_nodecollection'] = array(
'#type' => 'fieldset',
'#title' => t('select a node'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#parents' => $test,
);