- 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'.
parent
711378019d
commit
97d0a3fe6b
|
@ -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 === '') {
|
||||
|
|
Loading…
Reference in New Issue