我有一个名为 field_testfield 的 cck 字段,我已经在 .module 文件中以如下形式显示它。
现在我想将它包含在一个字段集中。对此有任何想法吗?
$form['field_testfield']['#weight'] = 10;
问问题
856 次
1 回答
1
实现字段集的正确方法是
$form['my_fieldset'] = array(
'#type' => 'fieldset',
'#weight' => 0,
'#collapsible' => TRUE, //is the fieldset collabsible?
'#collapsed' => TRUE //is the fieldset collabsped at start?
);
要在此字段集中添加字段,您可以将元素附加到字段集数组
$form['my_fieldset']['custom_field_1'] = array(
'#type' => 'textarea', //or whatever
'#weight' => 0 //the weight set here is the weight of the element inside the fieldset
);
于 2011-05-26T09:43:40.487 回答