summaryrefslogtreecommitdiff
path: root/modules/image/image.field.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/image/image.field.inc')
-rw-r--r--modules/image/image.field.inc13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc
index 1be15839c..60c0f5ac0 100644
--- a/modules/image/image.field.inc
+++ b/modules/image/image.field.inc
@@ -600,9 +600,12 @@ function theme_image_formatter($variables) {
$item = $variables['item'];
$image = array(
'path' => $item['uri'],
- 'alt' => $item['alt'],
);
+ if (array_key_exists('alt', $item)) {
+ $image['alt'] = $item['alt'];
+ }
+
if (isset($item['attributes'])) {
$image['attributes'] = $item['attributes'];
}
@@ -613,7 +616,7 @@ function theme_image_formatter($variables) {
}
// Do not output an empty 'title' attribute.
- if (drupal_strlen($item['title']) > 0) {
+ if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
$image['title'] = $item['title'];
}
@@ -625,9 +628,11 @@ function theme_image_formatter($variables) {
$output = theme('image', $image);
}
- if (!empty($variables['path']['path'])) {
+ // The link path and link options are both optional, but for the options to be
+ // processed, the link path must at least be an empty string.
+ if (isset($variables['path']['path'])) {
$path = $variables['path']['path'];
- $options = $variables['path']['options'];
+ $options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
// When displaying an image inside a link, the html option must be TRUE.
$options['html'] = TRUE;
$output = l($output, $path, $options);