function theme_image_formatter

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 image.field.inc theme_image_formatter($variables)
cle7 image.field.inc theme_image_formatter($variables)
elmsmedia7 image.field.inc theme_image_formatter($variables)
icor7 image.field.inc theme_image_formatter($variables)
meedjum_blog7 image.field.inc theme_image_formatter($variables)
mooc7 image.field.inc theme_image_formatter($variables)

Returns HTML for an image field formatter.

Parameters

$variables: An associative array containing:

  • item: Associative array of image data, which may include "uri", "alt", "width", "height", "title" and "attributes".
  • image_style: An optional image style.
  • path: An array containing the link 'path' and link 'options'.

Related topics

1 theme call to theme_image_formatter()
theme_lightbox2_image in sites/all/modules/ulmus/lightbox2/lightbox2.formatter.inc
Theme function for displaying the lightbox2 trigger image in an imagefield.
3 string references to the theme hook from theme_image_formatter()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

image_field_formatter_view in modules/image/image.field.inc
Implements hook_field_formatter_view().
image_theme in modules/image/image.module
Implements hook_theme().
theme_lightbox2_image in sites/all/modules/ulmus/lightbox2/lightbox2.formatter.inc
Theme function for displaying the lightbox2 trigger image in an imagefield.

File

modules/image/image.field.inc, line 599
Implement an image field, based on the file module's file field.

Code

function theme_image_formatter($variables) {
  $item = $variables['item'];
  $image = array(
    'path' => $item['uri'],
  );

  if (array_key_exists('alt', $item)) {
    $image['alt'] = $item['alt'];
  }

  if (isset($item['attributes'])) {
    $image['attributes'] = $item['attributes'];
  }

  if (isset($item['width']) && isset($item['height'])) {
    $image['width'] = $item['width'];
    $image['height'] = $item['height'];
  }

  // Do not output an empty 'title' attribute.
  if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
    $image['title'] = $item['title'];
  }

  if ($variables['image_style']) {
    $image['style_name'] = $variables['image_style'];
    $output = theme('image_style', $image);
  }
  else {
    $output = theme('image', $image);
  }

  // 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 = 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);
  }

  return $output;
}