Feature Request: Access to Album Parent info with Diff
I wanted access to the parent of an album to pass that to gallery.album for display purposes.
Modified Gallery snippet with the following changes:
--- snippet.gallery.php 2012-05-17 14:04:12.000000000 -0700
+++ snippet.gallery.new.php 2012-05-17 14:03:53.000000000 -0700
@@ -83,6 +83,7 @@
'Album.'.$albumField => $album->get($albumField),
));
$galleryId = $album->get('id');
+ $galleryParent = $album->get('parent');
$galleryName = $album->get('name');
$galleryDescription = $album->get('description');
unset($albumWhere,$albumField);
@@ -94,6 +95,7 @@
));
if (empty($album)) {
$galleryId = 0;
+ $galleryParent = '';
$galleryName = $tag;
$galleryDescription = '';
}
@@ -212,6 +214,7 @@
$modx->toPlaceholders(array(
$toPlaceholder => $output,
$toPlaceholder.'.id' => $galleryId,
+ $toPlaceholder.'.parent' => $galleryParent,
$toPlaceholder.'.name' => $galleryName,
$toPlaceholder.'.description' => $galleryDescription,
$toPlaceholder.'.total' => $count,
@@ -220,6 +223,7 @@
$placeholderPrefix = $modx->getOption('placeholderPrefix',$scriptProperties,'gallery.');
$modx->toPlaceholders(array(
$placeholderPrefix.'id' => $galleryId,
+ $placeholderPrefix.'.parent' => $galleryParent,
$placeholderPrefix.'name' => $galleryName,
$placeholderPrefix.'description' => $galleryDescription,
$placeholderPrefix.'total' => $count,
In my case I can pass [[+parent]] like [[!GalleryAlbums? &parent=[[+gallery.parent]] &showAll=0 &prominentOnly=0 ]] and create a sort of drill down effect with the display. Allows me to recreate the nested album effect shown in the manager.
This works for me and is a minor change. Not sure about the correct contents for parent when setting the defaults when $album is empty. Just left blank for now.
Please include this simple mod in one of the next revisions. Thanks Brian
Formatting on diff got all jacked up and I didn't realize it. Not sure how to post a legible diff. I can't see how to attache code.