You are here

function theme_itweak_upload_image_gallery in iTweak Upload 7.3

Theme function to show image attachments

Parameters

$variables: An associative array containing:

  • list: An array of file attachments, incl. links to thumbnails.
  • limit: Maximum number of thumbnails to display.
  • options: (optional) array of options for the gallery and thumbnail links.
    • (optional) 'gallery_type' element is given, it selects custom image gallery type.

Return value

The themed list

1 theme call to theme_itweak_upload_image_gallery()
theme_itweak_upload_image_gallery_body in ./itweak_upload.module
Theme function to show image attachments in an image gallery (full node view, also for teaser view in D7).

File

./itweak_upload.module, line 767
iTweakUpload - Tweak attachments display and file upload forms.

Code

function theme_itweak_upload_image_gallery($variables) {
  $list = $variables['items'];
  $options = $variables['options'];
  $gallery_type = isset($options['gallery_type']) ? $options['gallery_type'] : _itweak_upload_gallery_type_default();
  $carousel_visible = ITU_CAROUSEL_VISIBLE_ITEMS;
  $div_class = 'itu-attachment-images';
  $list_class = 'itu-attachment-thumbs';
  $jcarousellite = FALSE;

  // Check modules: we want to fallback if setting is left behind from disabled module
  if ($gallery_type == 'jcarousel' && !module_exists('jcarousel')) {
    $gallery_type = 'itu';
  }
  if ($gallery_type == 'jcarousellite') {
    if (!module_exists('jcarousellite') || count($list) <= $carousel_visible) {

      // This avoids jCarousel Lite bug with tiles fewer than carousel size
      $gallery_type = 'itu';
    }
    else {
      $jcarousellite = TRUE;
    }
  }
  if ($gallery_type != '' && $gallery_type != 'itu') {
    $div_class .= ' ' . $gallery_type;

    // add class
    $list_class .= '-' . $gallery_type;

    // change class
  }
  $output = '<div class="' . $div_class . '">';
  if ($jcarousellite) {
    $output .= '<a href="#" class="itu-attachment-jcarousellite-prev">&nbsp</a>';
  }
  $output .= theme('item_list', array(
    'items' => $list,
    'type' => 'ul',
    'attributes' => array(
      'class' => $list_class,
    ),
  ));
  if ($jcarousellite) {
    $output .= '<a href="#" class="itu-attachment-jcarousellite-next">&nbsp</a>';
  }
  $output .= '</div>';
  return $output;
}