summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-04 06:38:57 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-04 06:38:57 +0000
commit17e6076807b20a38b2bed98ea4d0cde24ce57fb1 (patch)
tree5477f7516cdc457019cd7894f93c26f767c5a85f /includes
parent3abd531fba32ef7f4b994f6b11ff263c98dbe4c5 (diff)
downloadbrdo-17e6076807b20a38b2bed98ea4d0cde24ce57fb1.tar.gz
brdo-17e6076807b20a38b2bed98ea4d0cde24ce57fb1.tar.bz2
#433992 by David_Rothstein and Frando: Change #theme_wrapper to #theme_wrappers to allow multiple theme functions to execute on renderable objects.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc25
-rw-r--r--includes/form.inc8
2 files changed, 18 insertions, 15 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
diff --git a/includes/form.inc b/includes/form.inc
index d65917ab6..866ac2ba7 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1935,7 +1935,7 @@ function form_process_text_format($element) {
unset($element['value']['#description']);
$element['#type'] = 'markup';
$element['#theme'] = NULL;
- $element['#theme_wrapper'] = 'text_format_wrapper';
+ $element['#theme_wrappers'] = array('text_format_wrapper');
$element['format'] = filter_form($element['#text_format'], 1, $element_parents);
// We need to clear the #text_format from the new child otherwise we
@@ -2104,14 +2104,14 @@ function theme_checkboxes($element) {
}
/**
- * Add form_element theming to an element if title or desription is set.
+ * Add form_element theming to an element if title or description is set.
*
* This is used as a pre render function for checkboxes and radios.
*/
function form_pre_render_conditional_form_element($element) {
if ($element['#title'] || $element['#description']) {
unset($element['#id']);
- $element['#theme_wrapper'] = 'form_element';
+ $element['#theme_wrappers'][] = 'form_element';
}
return $element;
}
@@ -2372,7 +2372,7 @@ function form_process_vertical_tabs($element, &$form_state) {
// that manually.
$element['group'] = array(
'#type' => 'fieldset',
- '#theme_wrapper' => '',
+ '#theme_wrappers' => array(),
'#parents' => $element['#parents'],
);