diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
commit | dccc333c765bb28da55b4a55d9c916acdb88413a (patch) | |
tree | bdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /views/default/page/components/gallery.php | |
parent | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff) | |
parent | 003cb81c7888f4d2fd763e5814027c6f8d71186f (diff) | |
download | elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'views/default/page/components/gallery.php')
-rw-r--r-- | views/default/page/components/gallery.php | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php index e86b9f885..f03eb1109 100644 --- a/views/default/page/components/gallery.php +++ b/views/default/page/components/gallery.php @@ -2,7 +2,17 @@ /** * Gallery view * - * @uses $vars['items'] + * Implemented as an unorder list + * + * @uses $vars['items'] Array of ElggEntity or ElggAnnotation objects + * @uses $vars['offset'] Index of the first list item in complete list + * @uses $vars['limit'] Number of items per page + * @uses $vars['count'] Number of items in the complete list + * @uses $vars['pagination'] Show pagination? (default: true) + * @uses $vars['position'] Position of the pagination: before, after, or both + * @uses $vars['full_view'] Show the full view of the items (default: false) + * @uses $vars['gallery_class'] Additional CSS class for the <ul> element + * @uses $vars['item_class'] Additional CSS class for the <li> elements */ $items = $vars['items']; @@ -19,6 +29,16 @@ $pagination = elgg_extract('pagination', $vars, true); $offset_key = elgg_extract('offset_key', $vars, 'offset'); $position = elgg_extract('position', $vars, 'after'); +$gallery_class = 'elgg-gallery'; +if (isset($vars['gallery_class'])) { + $gallery_class = "$gallery_class {$vars['gallery_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( 'offset' => $offset, @@ -33,10 +53,15 @@ if ($position == 'before' || $position == 'both') { } ?> -<ul class="elgg-gallery"> +<ul class="<?php echo $gallery_class; ?>"> <?php foreach ($items as $item) { - echo '<li>'; + if (elgg_instanceof($item)) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + } else { + $id = "item-{$item->getType()}-{$item->id}"; + } + echo "<li id=\"$id\" class=\"$item_class\">"; echo elgg_view_list_item($item, $vars); echo "</li>"; } |