I can't help it, each time I stumble on the pager's global variables, I have to closely look at the code to understand their meanings.

This patch aims at solving this problem by renaming the following variables:

$pager_page_array --> $pager_current_page
$pager_total --> $pager_page_count
$pager_total_items --> $pager_item_count

CommentFileSizeAuthor
pager_variable_names.patch7.56 KBdavid lesieur

Comments

dries’s picture

I think this is a a good patch, and I'd like to apply it. But I run all the tests 2 before and twice after applying this patch, and somehow there are two (additional) tests failing because of this patch. I can't quite figure out why ... I've stared at it for 20 minutes.

lilou’s picture

Status: Needs review » Needs work

Patch non longer applied : pager.inc (Cannot apply hunk @@ 7 )

catch’s picture

Version: 7.x-dev » 8.x-dev
sun’s picture

Issue tags: +API change

Nice one. However, those global variables should not exist in the first place. I'd rather remove them instead of prettifying them...

les lim’s picture

Title: Better names for pager global variables » Stop using global variables in theme_pager()
Status: Needs work » Active

Bumping this. I just encountered an issue where the search page was displaying the wrong number of pages because a pager in a views block was overriding $pager_total. Haven't looked at it too closely yet, though.

jhedstrom’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

theme_pager() is gone.