You are here

function image_field_caption_image_formatter in Image Field Caption 7.2

Override of theme_image_formatter().

1 string reference to 'image_field_caption_image_formatter'
image_field_caption_theme_registry_alter in ./image_field_caption.module
Implements hook_theme_registry_alter().

File

./image_field_caption.module, line 23
Provides a caption textarea for image fields.

Code

function image_field_caption_image_formatter($variables) {
  $image = theme_image_formatter($variables);

  // Now that Drupal has rendered the image, if there was a caption let's
  // render the image and the caption, otherwise just return the already
  // rendered image.
  if (isset($variables['item']['image_field_caption']) && !empty($variables['item']['image_field_caption']['value'])) {
    return theme('image_field_caption', array(
      'image' => $image,
      'caption' => check_markup($variables['item']['image_field_caption']['value'], $variables['item']['image_field_caption']['format']),
    ));
  }
  else {
    return $image;
  }
}