You are here

function theme_itweak_upload_image_gallery_body in iTweak Upload 7.3

Theme function to show image attachments in an image gallery (full node view, also for teaser view in D7).

Parameters

$variables: An associative array containing:

  • items: 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. See theme_itweak_upload_image_gallery().

Return value

The themed list

1 theme call to theme_itweak_upload_image_gallery_body()
itweak_upload_field_formatter_view in ./itweak_upload.module
Implements hook_field_formatter_view().

File

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

Code

function theme_itweak_upload_image_gallery_body($variables) {
  $files = $variables['items'];
  $limit = $variables['limit'];
  $options = $variables['options'];
  $items = array();
  foreach ($files as $file) {
    if ($limit != -1 && count($items) >= $limit) {

      // @todo Here we can initiate the "read more" link for teaser
      break;
    }
    $file = (object) $file;
    if ($file->display && empty($file->remove)) {
      if (isset($file->preview)) {
        $items[] = array(
          'data' => $file->preview['#value'],
          'class' => '',
        );
      }
    }
  }
  if (count($items)) {
    return theme('itweak_upload_image_gallery', array(
      'items' => $items,
      'options' => $options,
    ));
  }
}