From 601150c2627c017b29a1f240dc7398b36b7ca47f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 13 Dec 2009 12:42:28 +0000 Subject: - Patch #658302 by yched: re-purpose hook_field_sanitize() into hook_field_prepare_view(). --- modules/image/image.field.inc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'modules/image') diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc index f52193cb9..08bb41b0c 100644 --- a/modules/image/image.field.inc +++ b/modules/image/image.field.inc @@ -210,17 +210,19 @@ function image_field_load($obj_type, $objects, $field, $instances, $langcode, &$ } /** - * Implements hook_field_sanitize(). + * Implements hook_field_prepare_view(). */ -function image_field_sanitize($obj_type, $object, $field, $instance, $langcode, &$items) { +function image_field_prepare_view($obj_type, $objects, $field, $instances, $langcode, &$items) { // If there are no files specified at all, use the default. - if (empty($items) && $field['settings']['default_image']) { - if ($file = file_load($field['settings']['default_image'])) { - $items[0] = (array) $file + array( - 'is_default' => TRUE, - 'alt' => '', - 'title' => '', - ); + foreach ($objects as $id => $object) { + if (empty($items[$id]) && $field['settings']['default_image']) { + if ($file = file_load($field['settings']['default_image'])) { + $items[$id][0] = (array) $file + array( + 'is_default' => TRUE, + 'alt' => '', + 'title' => '', + ); + } } } } -- cgit v1.2.3