Skip to content
Browse files

snippet.galleryalbums: add id parameter

if set, shows only the album with the given id
  • Loading branch information...
1 parent e1a2006 commit 6e4250867233d204207f2f251fa720c0e205faa8 @cherbst committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 core/components/gallery/elements/snippets/snippet.galleryalbums.php
View
8 core/components/gallery/elements/snippets/snippet.galleryalbums.php
@@ -39,6 +39,7 @@
$start = $modx->getOption('start',$scriptProperties,0);
$parent = $modx->getOption('parent',$scriptProperties,0);
$showAll = $modx->getOption('showAll',$scriptProperties,false);
+$id = $modx->getOption('id',$scriptProperties,false);
$albumRequestVar = $modx->getOption('albumRequestVar',$scriptProperties,'galAlbum');
$albumCoverSort = $modx->getOption('albumCoverSort',$scriptProperties,'rank');
$albumCoverSortDir = $modx->getOption('albumCoverSortDir',$scriptProperties,'ASC');
@@ -78,6 +79,11 @@
}
$c->sortby($sort,$dir);
if ($limit > 0) { $c->limit($limit,$start); }
+if (!empty($id)) {
+ $c->where(array(
+ 'id' => $id,
+ ));
+}
$albums = $modx->getCollection('galAlbum',$c);
/* get thumb properties for album cover */
@@ -124,4 +130,4 @@
$modx->setPlaceholder($toPlaceholder,$output);
return '';
}
-return $output;
+return $output;

0 comments on commit 6e42508

Please sign in to comment.
Something went wrong with that request. Please try again.