You are here

function theme_imagefield_image_imagecache_shadowbox in Shadowbox 6.3

Same name and namespace in other branches
  1. 5.2 shadowbox.module \theme_imagefield_image_imagecache_shadowbox()
  2. 5 shadowbox.module \theme_imagefield_image_imagecache_shadowbox()
  3. 6.4 shadowbox.module \theme_imagefield_image_imagecache_shadowbox()
  4. 6.2 shadowbox.module \theme_imagefield_image_imagecache_shadowbox()

Implementation of theme_imagefield_image_imagecache_shadowbox().

1 theme call to theme_imagefield_image_imagecache_shadowbox()
theme_shadowbox_formatter_imagefield in ./shadowbox.module
Implementation of theme_shadowbox_formatter_imagefield().

File

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

Code

function theme_imagefield_image_imagecache_shadowbox($source, $destination, $item, $gallery_id = '', $field_type_names) {
  $filepath = $item['filepath'];
  if ($filepath == '') {
    return;
  }
  $alt = $item['data']['alt'];
  $title_text_setting = variable_get("shadowbox_title_text_{$field_type_names}", 0);
  switch ($title_text_setting) {
    case 0:
      $title = $item['data']['title'];
      break;
    case 1:
      $title = $item['data']['description'];
      break;
    case 2:
      $node = node_load($item['nid']);
      $title = $node->title;
      break;
  }
  $rel = $gallery_id != '' ? "shadowbox[{$gallery_id}]" : 'shadowbox';
  $link_attributes = array(
    'rel' => $rel,
    'title' => $title,
  );
  $options = array(
    'attributes' => $link_attributes,
    'html' => TRUE,
  );
  if ($source == 'original') {
    $image = theme('shadowbox_image', $filepath, $alt, $title);
  }
  else {
    $image = theme('imagecache', $source, $filepath, $alt, $title);
  }
  if ($destination == 'original') {
    $output = l($image, file_create_url($filepath), $options);
  }
  else {
    $output = l($image, shadowbox_imagecache_create_url($destination, $filepath), $options);
  }
  $wrapper_classes = $gallery_id != '' ? "sb-image sb-gallery sb-gallery-{$gallery_id}" : 'sb-image sb-indivdual';
  return '<div class="' . $wrapper_classes . '">' . $output . '</div>';
}