mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-29 10:26:46 -04:00
Extend siblings callbacks to take a $limit and an $offset for navigating
large sibling sets. Useful for the thumbnav module since we don't want to iterate a thousand siblings to find the one we care about. Fixes #1999.
This commit is contained in:
@@ -98,9 +98,9 @@ class Albums_Controller extends Items_Controller {
|
||||
"breadcrumbs" => Breadcrumb::array_from_item_parents($item));
|
||||
}
|
||||
|
||||
static function get_siblings($item) {
|
||||
static function get_siblings($item, $limit=null, $offset=null) {
|
||||
// @todo consider creating Item_Model::siblings() if we use this more broadly.
|
||||
return $item->parent()->viewable()->children();
|
||||
return $item->parent()->viewable()->children($limit, $offset);
|
||||
}
|
||||
|
||||
public function create($parent_id) {
|
||||
|
||||
@@ -86,8 +86,10 @@ class Theme_View_Core extends Gallery_View {
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
public function siblings() {
|
||||
return call_user_func_array($this->siblings_callback[0], $this->siblings_callback[1]);
|
||||
public function siblings($limit=null, $offset=null) {
|
||||
return call_user_func_array(
|
||||
$this->siblings_callback[0],
|
||||
array_merge($this->siblings_callback[1], array($offset, $limit)));
|
||||
}
|
||||
|
||||
public function tag() {
|
||||
|
||||
@@ -110,8 +110,8 @@ class Search_Controller extends Controller {
|
||||
Breadcrumb::instance($item->title, $item->url())->set_last()));
|
||||
}
|
||||
|
||||
static function get_siblings($q, $album) {
|
||||
$result = search::search_within_album(search::add_query_terms($q), $album, 1000, 1);
|
||||
static function get_siblings($q, $album, $limit=1000, $offset=1) {
|
||||
$result = search::search_within_album(search::add_query_terms($q), $album, $limit, $offset);
|
||||
return $result[1];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user