Как разместить поле cck внутри fieldset? - PullRequest
2 голосов
/ 20 мая 2011

У меня есть поле cck с именем field_testfield, и я отобразил его в виде файла .module, как показано ниже. $form['field_testfield']['#weight'] = 10;<br /> Теперь я хочу заключить его в набор полей.Есть идеи по этому поводу?

1 Ответ

1 голос
/ 26 мая 2011

правильный способ реализации наборов полей -

$form['my_fieldset'] = array(
  '#type' => 'fieldset',
  '#weight' => 0,
  '#collapsible' => TRUE, //is the fieldset collabsible?
  '#collapsed' => TRUE //is the fieldset collabsped at start?
);

чтобы добавить поля внутри этого набора полей, вы бы добавили элементы в массив fieldset

$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
);
...