Download & Extend

Refactor pager_query so pager can be used outside pager_query

Project:Drupal core
Version:7.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

I was working on the z3950 module, which implements hook_search to display content from z39.50 (library) servers. The results being displayed aren't from a Drupal database, so pager_query() can't be used. But, there are lots of results, that can be chunked into pages, and thus should use the Drupal paging system.

The attached patch slightly refactors pager_query, keeping the original functionality intact, but exposes a new function called pager_init() which can be used by contrib modules.

AttachmentSizeStatusTest resultOperations
pager_5.patch2.03 KBIgnored: Check issue status.NoneNone

Comments

#1

... removing one extraneous line in patch file

AttachmentSizeStatusTest resultOperations
173037.patch2.02 KBIgnored: Check issue status.NoneNone

#2

i once did this without a patch: http://cvs.drupal.org/viewvc.py/drupal/contributions/tricks/pager_withou.... that might have bit rotted since then. maybe this patch is useful still - i dunno.

#3

Yes, it can be done without a patch. I'm just proposing some refactoring so that we get a new API function that makes it easier to do. Compared to your "trick" solution, what you get by using the pager call is an additional calculations on page position.

#4

Reroll from root.
D7 fodder?
Reroll brought to you by patch bingo.

AttachmentSizeStatusTest resultOperations
173037_4.patch2.08 KBIgnored: Check issue status.NoneNone

#5

Version:6.x-dev» 7.x-dev

If it can be done without API changes, I guess it will be something for D7...

#6

Patch still applied.

#7

Why is testbot not testing this?

I like it muchly - reinventing pagers just because you are not using a database query is annoying.

#8

* Coding standard correction in comments.
* Add NULL default argument for $count in pager_init()

AttachmentSizeStatusTest resultOperations
issue-173037-8.patch2.15 KBIdleUnable to apply patch issue-173037-8.patchView details | Re-test

#9

Status:needs review» needs work

Needs updating for dbtng - db_result() is deprecated.