You are here

function theme_shadowbox_thumbnail in Shadowbox 7.4

Same name and namespace in other branches
  1. 8 shadowbox.module \theme_shadowbox_thumbnail()

Returns an image.

Parameters

$variables: An associative array containing:

  • path: The uri || url of the image.
  • image_style: An optional image style.
  • attributes: An optional array of attributes.
  • title: The title to use on the image.
  • alt: An optional alt attribute.
3 theme calls to theme_shadowbox_thumbnail()
file_shadowbox_field_formatter_view in file_shadowbox/file_shadowbox.module
Implements hook_field_formatter_view().
image_shadowbox_field_formatter_view in image_shadowbox/image_shadowbox.module
Implements hook_field_formatter_view().
insert_shadowbox_insert_content in insert_shadowbox/insert_shadowbox.module

File

./shadowbox.module, line 366
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function theme_shadowbox_thumbnail($variables) {
  $image = array(
    'path' => $variables['path'],
  );
  if (isset($variables['attributes']) && $variables['attributes']) {
    $image['attributes'] = $variables['attributes'];
  }
  if (isset($variables['alt']) && drupal_strlen($variables['alt']) > 0) {
    $image['alt'] = $variables['alt'];
  }

  // Do not output an empty 'title' attribute.
  if (isset($variables['title']) && drupal_strlen($variables['title']) > 0) {
    $image['title'] = $variables['title'];
    if (!isset($image['alt'])) {
      $image['alt'] = $variables['title'];
    }
  }
  $image_style = $variables['image_style'];
  if ($image_style) {
    $image['style_name'] = $image_style;
    $image['attributes'] = array(
      'class' => 'image-' . $image_style,
    );
    $output = theme('image_style', $image);
  }
  else {
    $output = theme('image', $image);
  }
  return $output;
}