div->div->div-standard+div-admin+submin-button" />
开发者

drupal_render: how to make well-formed div structure of the form?

I noticed, forms "story_node_form" or "node_form" are formed like this: form->div->div->div-standard+div-admin+submin-button

My custom content type is not formed this way:

  • I have 49 checkboxes. I placed them with drupal_render() into table like here: http://eugen.gotdns.com/test/zeitplaner.png

  • After that i've done drupal_render($form) to render the rest of the form

Problems:

1) My created table is on the top of the form, how can i move it down?

2) How can i place my table into collapsable group?

3) Why submit and previe开发者_高级运维w buttons are on the top of the form below my table?


Because you rendered your table, then the rest of the form it is acting as expected, whereas if you where to place it in the $form array with the appropriate weight it would be rendered where it is expected with only the one drupal_render($form).

As for the collapsible group, you'd want to wrap your form elements in a collapsible fieldset, like so:

$form['wrapper-id'] = array(
  '#type' => 'fieldset',
  '#title' => t('title'),
  '#collapsible' => TRUE,
);
$form['wrapper-id']['yourstuff'] = array(
  // Your stuff
);

For more information about modifying forms, refer to the Form API documentation: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜