diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-12-11 17:47:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-12-11 17:47:36 +0000 |
commit | 97d0a3fe6b094ad1f9c88619b755e6f1f5d0bb75 (patch) | |
tree | e8617eab0f147e07661c0a8a9827d0bffb65bf35 | |
parent | 711378019da80ad9005bc32c9421453523cb8655 (diff) | |
download | brdo-97d0a3fe6b094ad1f9c88619b755e6f1f5d0bb75.tar.gz brdo-97d0a3fe6b094ad1f9c88619b755e6f1f5d0bb75.tar.bz2 |
- Patch #100787 by chx: having a #theme for an element changes the meaning of prefix from 'prefix of this element' to 'prefix of the children elements'.
-rw-r--r-- | includes/common.inc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc index f7ec8f735..0d8d3b477 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2094,8 +2094,10 @@ function drupal_render(&$elements) { if (isset($elements['#theme']) && empty($elements['#theme_used'])) { $elements['#theme_used'] = TRUE; - $previous_value = isset($elements['#value']) ? $elements['#value'] : NULL; - $previous_type = $elements['#type']; + $previous = array(); + foreach (array('#value', '#type', '#prefix', '#suffix') as $key) { + $previous[$key] = isset($elements[$key]) ? $elements[$key] : NULL; + } // If we rendered a single element, then we will skip the renderer. if (empty($children)) { $elements['#printed'] = TRUE; @@ -2105,11 +2107,12 @@ function drupal_render(&$elements) { } $elements['#type'] = 'markup'; + unset($elements['#prefix'], $elements['#suffix']); $content = theme($elements['#theme'], $elements); - $elements['#value'] = $previous_value; - $elements['#type'] = $previous_type; - unset($elements['#prefix'], $elements['#suffix']); + foreach (array('#value', '#type', '#prefix', '#suffix') as $key) { + $elements[$key] = isset($previous[$key]) ? $previous[$key] : NULL; + } } /* render each of the children using drupal_render and concatenate them */ if (!isset($content) || $content === '') { |