Re: set_display_context_callback() and incorrect pagination
Bharat Mediratta <[email protected]> Tue, 29 Jan 2013 10:55:40 -0800
| Newsgroups | gmane.comp.web.gallery.devel |
|---|---|
| Message-ID | <CAESa+_mHH=cxHa91BLD4QP=b422yARBB9o3w2HvH7N=rgrpVmg@mail.gmail.com> |
The only canonical place to get the siblings is from the display context,
but currently our display context does not provide that information. I
think the right solution here is to extend the API for display contexts to
provide a callback function that the theme can call to get the entire list
of siblings. So for example, Search_Controller::get_display_context would
return:
return array("position" => $position,
"previous_item" => $previous_item,
"next_item" => $next_item,
"sibling_count" => $count,
*"siblings_callback" => array(array("search",
"search_within_album"), array($item, $query_terms, $album)),*
"breadcrumbs" => array(
Breadcrumb::instance($root->title, "/",
$root->id)->set_first(),
Breadcrumb::instance(t("Search: %q", array("q" => $q)),
$search_url),
Breadcrumb::instance($item->title,
$item->url())->set_last()));
Then the theme will have access to the siblings as a callback:
call_user_func_array($siblings_callback[0], $siblings_callback[1]);
That'll provide the right set of siblings for anybody who wants them.
Thoughts?
-Bharat
On Tue, Jan 29, 2013 at 3:23 AM, Mike Miller <[email protected]> wrote:
> On Tue, Jan 29, 2013 at 1:20 PM, Mike Miller <[email protected]> wrote:
> > On Mon, Jan 28, 2013 at 8:46 PM, Mike Miller <[email protected]>
> wrote:
> >> Is there a better API to use to get the "siblings" (cousins, perhaps)
> >> rather than asking for the parent's children?
> >
> > I just saw that rWatcher handled this in his tag_albums module using
> > "dynamic_siblings"; see
> >
> https://github.com/gallery/gallery3-contrib/tree/master/3.0/modules/tag_albums/--%20Theme%20Files/Grey%20Dragon%203.2.2
> > for the theme modifications.
> >
> > This looks like a rather nice way to let controllers pass information
> > about their virtual environments. What do you think about putting this
> > into tag, dynamic, search, latestupdates, and any other modules that
> > set their own display context, for themes or modules that want to show
> > more information about siblings (maybe "neighbors" is a better word
> > here) than the default previous_page_url / next_page_url?
>
> One thing that I forgot to mention; one downside about
> dynamic_siblings is that he's still computing the URL using a
> hardcoded scheme. Perhaps the variables should include a get_url
> callback (or does #item->url() provide this already?)?
>
> > -- Mike
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
__[ g a l l e r y - d e v e l ]_________________________
[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]