8.2.x common.inc drupal_render_children(&$element, $children_keys = NULL)
8.0.x common.inc drupal_render_children(&$element, $children_keys = NULL)
8.1.x common.inc drupal_render_children(&$element, $children_keys = NULL)
8.3.x common.inc drupal_render_children(&$element, $children_keys = NULL)
7.x common.inc drupal_render_children(&$element, $children_keys = NULL)

Renders children of an element and concatenates them.


array $element: The structured array whose children shall be rendered.

array $children_keys: (optional) If the keys of the element's children are already known, they can be passed in to save another run of element_children().

Return value

string The rendered HTML of all children of the element.

See also


31 calls to drupal_render_children()
template_preprocess_block_admin_display_form in modules/block/block.admin.inc
Processes variables for block-admin-display-form.tpl.php.
template_preprocess_poll_vote in modules/poll/poll.module
Themes the voting form for a poll.
theme_aggregator_categorize_items in modules/aggregator/aggregator.pages.inc
Returns HTML for the aggregator page list form for assigning categories.
theme_color_scheme_form in modules/color/color.module
Returns HTML for a theme's color form.
theme_confirm_form in modules/system/system.module
Returns HTML for a confirmation form.

... See full list


includes/common.inc, line 6120
Common functions that many Drupal modules will need to reference.


function drupal_render_children(&$element, $children_keys = NULL) {
  if ($children_keys === NULL) {
    $children_keys = element_children($element);
  $output = '';
  foreach ($children_keys as $key) {
    if (!empty($element[$key])) {
      $output .= drupal_render($element[$key]);
  return $output;


henryhu’s picture

I get a complete form when rendering it with render(). But if using drupal_render_children(), it ends up a form without wrapper <form> element. So, don't forget to add the element in your templates.