From 0574069b0c184186933a459bdd067196b3052b11 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 20 Aug 2010 21:19:47 -0400 Subject: [PATCH] Move logic for returning childImageIds to a function --- ansel/lib/View/GalleryRenderer/Base.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ansel/lib/View/GalleryRenderer/Base.php b/ansel/lib/View/GalleryRenderer/Base.php index dff7c9510..744a70751 100644 --- a/ansel/lib/View/GalleryRenderer/Base.php +++ b/ansel/lib/View/GalleryRenderer/Base.php @@ -163,17 +163,9 @@ abstract class Ansel_View_GalleryRenderer_Base unset($this->style['widgets']['Actions']); } - // I *think* this is more efficient, iterate over the children - // since we already have them instead of calling listImages. - //$image_ids = $this->view->gallery->listImages($this->pagestart, $this->pagestart + $this->perpage); - $ids = array(); - foreach ($this->children as $child) { - if ($child instanceof Ansel_Image) { - $ids[] = $child->id; - } - } // Gallery widgets always receive an array of image ids for // the current page. + $ids = $this->getChildImageIds(); foreach ($this->style['widgets'] as $wname => $wparams) { $wparams = array_merge($wparams, array('images' => $ids)); $this->view->addWidget(Ansel_Widget::factory($wname, $wparams)); @@ -205,6 +197,17 @@ abstract class Ansel_View_GalleryRenderer_Base $this->pageend = min($this->numTiles, $this->pagestart + $this->perpage - 1); } + public function getChildImageIds() + { + $ids = array(); + foreach ($this->children as $child) { + if ($child instanceof Ansel_Image) { + $ids[] = $child->id; + } + } + return $ids; + } + /** * Return the HTML for this view. Done this way so we can override this in * subclasses if desired. -- 2.11.0