In case several pagers are present on the page, having several elements with id 'pager' breaks markup validation.

Comments

Robrecht Jacques’s picture

Status: Active » Needs review
StatusFileSize
new1.36 KB

Seems correct to me: as there can be multiple pagers on one page, one would have multiple divs with the same id, which is not allowed. So making it a class would solve that.

Of course the .css file also needs to be altered to use .pager instead of #pager.

Patch attached.

beginner’s picture

Status: Needs review » Reviewed & tested by the community

The argumentation makes sense.
I grepped but couldn't find other occurrences of #pager or id="pager" other than the ones in the patch.

I don't know how this would affect custom made themes, though. I guess very few, if any, would theme #pager, so I think it is safe.

I set as RTBC, but I don't know the exact policy on such changes.

dries’s picture

How can there be multiple pagers on the same page? How do you make the URLs of each pager different so the pager code knows what pager is clicked? AFAIK, we don't support multiple pagers on the same page, but I might be wrong ... please clarify how you use this so we can evaluate the usefulness/correctness of this patch.

yched’s picture

Dries :

$element An optional integer to distinguish between multiple pagers on one page.

on http://api.drupal.org/api/HEAD/function/theme_pager
and http://api.drupal.org/api/HEAD/function/pager_query
It seems we do support multiple pagers on one page.
I think Views support this, for instance.

Plus, even with only one paged content, I guess you might want to have the pager above _and_ below a large table.

dries’s picture

Ah, makes sense.

dries’s picture

Version: x.y.z » 4.7.3

Committed to CVS HEAD.

edmund.kwok’s picture

Version: 4.7.3 » 4.7.4
StatusFileSize
new1.35 KB

Attached patch for 4.7.4.

killes@www.drop.org’s picture

I am not sure I should apply this to 4.7. Wouldn't this break any custom CSS? To have two pagers on one page is probably rarer than theming the single pager that is usually there.

webchick’s picture

Agreed. Any existing theme which had styled the pager would cease to work with this patch. Kind of a mean thing to do in a stable version of Drupal.

edmund.kwok’s picture

I agree also, found at least 30 themes using #pager. Well, set this to fixed then? Btw, documentation needed for 4.7->5.0 themes in regards to the original patch that Dries committed.

gerhard killesreiter’s picture

Version: 4.7.4 » x.y.z
Status: Reviewed & tested by the community » Fixed

done

Anonymous’s picture

Status: Fixed » Closed (fixed)