2

field_testfieldという名前のcckフィールドがあり、次のように.moduleファイルの形式で表示しました。 今、私はそれをフィールドセットで囲みたいと思います。これについて何か考えはありますか?
$form['field_testfield']['#weight'] = 10;

4

1 に答える 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 に答える