diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-26 19:09:32 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-26 19:09:32 +0000 |
commit | 430a37f010d032aea56a88d2e62beeea4ce2a3c9 (patch) | |
tree | 2945f6aac168e091f40cd337fb9de5c04c245cab /modules/field | |
parent | b3e42eb5cded266384e6b3ba73fc0d143d9332db (diff) | |
download | brdo-430a37f010d032aea56a88d2e62beeea4ce2a3c9.tar.gz brdo-430a37f010d032aea56a88d2e62beeea4ce2a3c9.tar.bz2 |
#623314 by yched, peximo, and plach: Remove extra phantom properties rendered on comment preview.
Diffstat (limited to 'modules/field')
-rw-r--r-- | modules/field/field.module | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/field/field.module b/modules/field/field.module index 708677bdc..1700a4d9c 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -680,9 +680,17 @@ function template_preprocess_field(&$variables) { $field_type_css = strtr($field['type'], '_', '-'); $field_name_css = strtr($field['field_name'], '_', '-'); - // If the formatter is multiple, the template sees only one 'item', which - // will include all values. - $items = $element['#formatter_single'] ? $element['items'] : array($element['items']); + // Prepare an $items variable that the template can simply loop on. + if ($element['#formatter_single']) { + // Filter out non-children properties that might have been added if the + // renderable array has gone through form_builder(). + $items = array_intersect_key($element['items'], array_flip(element_children($element['items']))); + } + else { + // If the formatter is multiple, the template sees only one 'item', which + // will include all values. + $items = array($element['items']); + } $additions = array( 'object' => $element['#object'], |