diff options
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/includes/common.inc b/includes/common.inc index 15104c340..205932b36 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3792,7 +3792,7 @@ function drupal_render_page($page) { * Recursively iterates over each of the array elements, generating HTML code. * * HTML generation is controlled by two properties containing theme functions, - * #theme and #theme_wrapper. + * #theme and #theme_wrappers. * * #theme is the theme function called first. If it is set and the element has * any children, they have to be rendered there. For elements that are not @@ -3801,21 +3801,22 @@ function drupal_render_page($page) { * children, they are rendered and concatenated into a string by * drupal_render_children(). * - * The theme function in #theme_wrapper will be called after #theme has run. - * It can be used to add further markup around the rendered children, e.g. - * fieldsets add the required markup for a fieldset around their rendered - * child elements. A wrapper theme function always has to include the - * element's #children property in its output, as this contains the rendered + * The #theme_wrappers property contains an array of theme functions which will + * be called, in order, after #theme has run. These can be used to add further + * markup around the rendered children; e.g., fieldsets add the required markup + * for a fieldset around their rendered child elements. All wrapper theme + * functions have to include the element's #children property in their output, + * as it contains the output of the previous theme functions and the rendered * children. * - * For example, for the form element type, by default only the #theme_wrapper + * For example, for the form element type, by default only the #theme_wrappers * property is set, which adds the form markup around the rendered child * elements of the form. This allows you to set the #theme property on a * specific form to a custom theme function, giving you complete control over * the placement of the form's children while not at all having to deal with * the form markup itself. * - * This function is usually called from within a another function, like + * This function is usually called from within another function, like * drupal_get_form() or a theme function. Elements are sorted internally * using uasort(). Since this is expensive, when passing already sorted * elements to drupal_render(), for example from a database query, set @@ -3882,10 +3883,12 @@ function drupal_render(&$elements) { $elements['#children'] = drupal_render_children($elements, $children); } - // Let the theme function in #theme_wrapper add markup around the rendered + // Let the theme functions in #theme_wrappers add markup around the rendered // children. - if (!empty($elements['#theme_wrapper'])) { - $elements['#children'] = theme($elements['#theme_wrapper'], $elements); + if (isset($elements['#theme_wrappers'])) { + foreach ($elements['#theme_wrappers'] as $theme_wrapper) { + $elements['#children'] = theme($theme_wrapper, $elements); + } } // Filter the outputted content and make any last changes before the |