From 97d0a3fe6b094ad1f9c88619b755e6f1f5d0bb75 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 11 Dec 2006 17:47:36 +0000 Subject: - 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'. --- includes/common.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'includes/common.inc') 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 === '') { -- cgit v1.2.3