Spin-off from #1190436: Full Pager: The ellipsis ("...") button does nothing
This patch replaces all the theme_pager_* functions with theme suggestions based off of theme_pager_link(). With this change a themer can add any of the following functions to template.php:
mytheme_pager_link($variables){ ... }
mytheme_pager_link__first($variables){ ... }
mytheme_pager_link__last($variables){ ... }
mytheme_pager_link__previous($variables){ ... }
mytheme_pager_link__next($variables){ ... }
.. or they can create the corresponding tpl instead.
Patch by @bleen18
Comment | File | Size | Author |
---|---|---|---|
#24 | cleanup-pager.patch | 9.21 KB | dodorama |
#16 | 1598886.patch | 10.23 KB | bleen |
#15 | 1598886.patch | 10.23 KB | bleen |
#11 | 1598886.patch | 10.25 KB | bleen |
#9 | 1598886.patch | 10.26 KB | bleen |
Comments
Comment #1
bleen CreditAttribution: bleen commentedThis is my summary copied from the original issue:
I replaced all the theme_pager_* functions with theme suggestions based off of theme_pager_link(). With this change a themer can add any of the following functions to template.php:
mytheme_pager_link($variables){ ... }
mytheme_pager_link__first($variables){ ... }
mytheme_pager_link__last($variables){ ... }
mytheme_pager_link__previous($variables){ ... }
mytheme_pager_link__next($variables){ ... }
.. or they can create the corresponding tpl instead.
Thanks @sun for copying this over ...
Comment #2
bleen CreditAttribution: bleen commenteddrupal8.pager-theme.0.patch queued for re-testing.
Comment #4
bleen CreditAttribution: bleen commentedreroll
Comment #6
bleen CreditAttribution: bleen commentedDoh! .. re-roll
Comment #7
bleen CreditAttribution: bleen commentedComment #8
sunApparently, this patch needed a re-roll due to the recently added 'rel' attributes.
They do not seem to be contained in the new code.
Comment #9
bleen CreditAttribution: bleen commentedI missed that, thanks ...
this patch includes the "rel" attributes
Comment #10
sunPrevious has a rel of last.
The special last and next links do not get rel attributes.
Comment #11
bleen CreditAttribution: bleen commentedI had a small error in #9. Please ignore it and review this one
Sun: WOW you're fast...
Comment #12
jenlamptonI think this needs to be rerolled because of the attributes change
#1290694: Provide consistency for attributes and classes arrays provided by template_preprocess()
See http://drupal.org/node/1727592
Comment #13
jenlamptonNo, that was my code that needed to be updaed :/
Comment #14
jenlamptonOkay, patch applies cleanly.
bartik_pager_link() works.
bartik_pager_link__first() works.
bartik_pager_link__last() works.
But bartik_pager_link__previous() and bartik_pager_link__next() seem to affect more than just the previous and next links. It also affects the numeric link that represents the same page as the next/prev link.
I don't think that's the desired affect.
Comment #15
bleen CreditAttribution: bleen commentedThis should solve the issue that jenlampton caught in #14
Comment #16
bleen CreditAttribution: bleen commented... and one more without the whitespace issues
Comment #17
sunWould be good to do another round of testing here, but otherwise this patch looks great to me :)
Do we want to make the merger of theme_pager_link* theme functions into theme_link() a separate follow-up issue? I think that attacking that separately would make sense, as it rather relates to the Theme Component Library idea/effort.
Thus, created two related follow-ups:
#1778990: Merge theme_pager_link*() theme functions into theme_link()
#1778992: Merge theme_menu_link/_local_task/_local_action() theme functions into theme_link()
Comment #18
podarokrelated change record http://drupal.org/node/1795832 from #1777324: Remove theme_user_list() from core here
Comment #19
catchWhat tests do we need for this? Manual ones to ensure the CSS/Markup is equivalent? Would be good to get this one in.
Comment #20
bleen CreditAttribution: bleen commentedThat is how I have been testing...
Comment #21
sunyeah, I meant manual tests in #17 and still think that's sufficient. Just to make sure that we don't have a mistake as in #14. ;)
Comment #22
dodorama CreditAttribution: dodorama commented#16: 1598886.patch queued for re-testing.
Comment #24
dodorama CreditAttribution: dodorama commentedThis is my first attempt at re-rolling a patch. I hope it worked properly.
Comment #25
dodorama CreditAttribution: dodorama commentedI did a manual testing. Here's a diff of the markup.
It looks good to me.
Comment #26
jwilson3Its always bugged me that the links in the pager have the benefit of an extra element in the dom for theming, while the plain text items (current page, and ellipses) do not. This means you have to get creative (and inconsistent) with the CSS. Maybe this belongs as a separate request, for CSS lint cleanup or standardizing the Component Library but it would be incredibly useful to add a wrapper span around non-links in the pager, which would pave the way for consistent css like this:
I understand if this is too little too late, but its worth a try ;)
Comment #27
jwilson3In other words, #26 is justification for providing
theme_pager_link__ellipse
andtheme_pager_link__current
as well.Comment #28
jwilson3One more thing...
Quoting from the proposed resolution in #1499460: [meta] New theme system (emphasis added by me):
Please, correct me if wrong, but this kind of throws a monkey wrench into the current work to *create more themables for pagers*.
Without knowing too much about the internals of pagers, it seems like it would be pretty easy to convert pagers to a simple theme_list() if we moved the classes off of the LI into to the item appearing in the list, and used wrapper elements like SPANS suggested in #26. It would also make the CSS even *more* clean than the example in #26, because we could get away with using *just classes*:
Comment #29
catch@jwilson3: that's #1778990: Merge theme_pager_link*() theme functions into theme_link() but this patch makes that one easier - since we end up with only one pager theme function instead of four or however many it currently is to convert.
Comment #30
bleen CreditAttribution: bleen commentedSo based on the re-roll in #24 and the HTML diff in #25 is this now RTBC?
Comment #31
jwilson3Thanks catch.
One more question, why are there two underscores in pager_link__first? is this a new feature of drupal 8 theming?
Comment #32
bleen CreditAttribution: bleen commented@jwilson .... actually that was added in D7. See http://drupal.org/node/1089656 for more details
Comment #33
jwilson3#lightbulb. Ok, yeah. Definitely knew about theme suggestions, but always encountered that feature from the front end point of view '--', never really thought about how that could be useful in Drupal core. Nice usage here.
Comment #34
catchRTBC per the manual testing.
Comment #35
podaroklooks like its Twig related too
+1 RTBC for #24
Comment #36
sun#24: cleanup-pager.patch queued for re-testing.
Comment #37
catchCommitted/pushed to 8.x, thanks!
Will need a change notice for the removed/replaced theme functions.
Comment #38
bleen CreditAttribution: bleen commentedHavent done a change notice before so lemme know what Im missing... http://drupal.org/node/1819308
Comment #39
bleen CreditAttribution: bleen commentedComment #40
catchThe content looks fine, but all the metadata/title etc. is about the entity render controller.
Comment #41
tim.plunkettIt appears that instead of making a new change notice, you edited an existing one? I've reverted it. See http://drupal.org/node/1819308/revisions/view/2409260/2409470
I'm guessing you were using one as an example, and just copy/pasted into the wrong tab.
Comment #42
bleen CreditAttribution: bleen commentedDOH!!!!! Tim.plunkett nailed it.
Sorry bout that. This should be better: http://drupal.org/node/1819788
Comment #43
catchLooks great.
Comment #44
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedComment #45.0
(not verified) CreditAttribution: commentedAdding summary from original issue