1

I have implemented a new entity type that requires paged access to DB and meet a probem with several pagers for independent entities on the same theme page.

The problem is that that entity can be used along with the node, thus two (or more) pagers may co-exist on the same page. The element property of PagerDefault apparently does not work (see discussion). In addition, PagerDefault simply uses $_GET['page']) to find required page number, which leads to even bigger confusion - both absolutely independed DB queries share same HTTP page query parameter.

What do you believe is good solution of this problem?

Further investigations have revealed a bug with EntityFieldQuery::pager()

1 Answer 1

1

I'm not sure I understand your problem ... Are we talking about like a node/edit page or a View? Or is this a menu page callback where you want node(s) and this entity both with paged output on a single html page ... ?

If you have written custom PHP/SQL/EFQ in a menu page callback, I see no reason you cannot explicitly set $element uniquely as needed in your queries.

Where is your http page query parameter coming from? A view? A url() you created by hand? If you have 2 pagers, you should have 2 $GET parameters ...

Edit: this is what I mean blog example

4
  • I have menu page callback. As far as I understand, I can not choose element in a reliable way - no collision detection implmented in PageDefault. As it is clear from documentation, that if I choose element number for one pager, I have to set element for all pagers to eliminate collision, which I can not do in my circumstances. I understand that it will work somehow, but without reliable guaranty of collision avoidance. Probably, I am wrong and just do not get the pager concept.
    – Michael
    Mar 18, 2012 at 16:38
  • sorry please list what you have on the page that requires pagers. A view? EFQ listings? what ...
    – tenken
    Mar 18, 2012 at 16:57
  • I have a node that use EFQ listings for text posts and I plan to have another entity (in another block) that retrieve different information from the DB, and should use pager to limit amount of data. The problem is if I can use PagerDefault extender for both pagers, or it is impossible.
    – Michael
    Mar 18, 2012 at 17:39
  • Thanks, tenken. The blog example is really helpful. But in my case I can not be sure that a page will have just one pager, of if all pagers will be assigned with ID - my part of job is just a couple of modules, not a site.
    – Michael
    Mar 18, 2012 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.