You are here

function theme_image_gallery in Image 5

Same name and namespace in other branches
  1. 5.2 contrib/image_gallery/image_gallery.module \theme_image_gallery()
  2. 6 contrib/image_gallery/image_gallery.pages.inc \theme_image_gallery()
  3. 7 contrib/image_gallery/image_gallery.pages.inc \theme_image_gallery()

Theme a gallery page

1 theme call to theme_image_gallery()
image_gallery_page in contrib/image_gallery/image_gallery.module
Image gallery callback, displays an image gallery

File

contrib/image_gallery/image_gallery.module, line 330

Code

function theme_image_gallery($galleries, $images) {
  drupal_add_css(drupal_get_path('module', 'image_gallery') . '/image_gallery.css');
  $size = image_get_sizes(IMAGE_THUMBNAIL);
  $content = '';
  if (count($galleries)) {
    $content .= '<ul class="galleries">';
    foreach ($galleries as $gallery) {
      $content .= '<li class="clear-block">';
      if ($gallery->count) {
        $content .= l(image_display($gallery->latest, IMAGE_THUMBNAIL), 'image/tid/' . $gallery->tid, array(), NULL, NULL, FALSE, TRUE);
      }
      $content .= "<h3>" . l($gallery->name, 'image/tid/' . $gallery->tid) . "</h3>\n";
      $content .= '<div class="description">' . check_markup($gallery->description) . "</div>\n";
      $content .= '<p class="count">' . format_plural($gallery->count, 'There is 1 image in this gallery', 'There are @count images in this gallery') . "</p>\n";
      if ($gallery->latest->changed) {
        $content .= '<p class="last">' . t('Last updated: %date', array(
          '%date' => format_date($gallery->latest->changed),
        )) . "</p>\n";
      }
      $content .= "</li>\n";
    }
    $content .= "</ul>\n";
  }
  if (!empty($images)) {
    $content .= '<ul class="images">';
    foreach ($images as $image) {
      $content .= theme('image_gallery_img', $image, $size);
    }
    $content .= "</ul>\n";
  }
  if ($pager = theme('pager', NULL, variable_get('image_images_per_page', 6), 0)) {
    $content .= $pager;
  }
  if (count($images) + count($galleries) == 0) {
    $content .= '<p class="count">' . format_plural(0, 'There is 1 image in this gallery', 'There are @count images in this gallery') . "</p>\n";
  }
  return $content;
}