Assigning any fieldset element a #theme value causes drupal_render() to bypass recursively rendering its children. The result is a twice-printed fieldset with nothing inside.

If a form element has a specified #theme value, drupal_render() assumes it has no children and renders it immediately. Line 2822 of common.inc:

  $content = theme($elements['#theme'], $elements);

If #theme is not specified, the fieldset is rendered on line 2841:

    $content = theme(!empty($elements['#type']) ? $elements['#type'] : 'markup', $elements);

Comments

Anonymous’s picture

subscribe

eli-t’s picture

subscribe

remi’s picture

I'm having the same problem right now.

sun’s picture

Status: Active » Closed (works as designed)

That's correct and by design. #theme functions are supposed to render the element including all children. If any children need to be rendered on their own, then do not assign a #theme function. There are also #theme_wrappers and #pre_render.