Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
given the example code in \Drupal\Core\Pager\PagerManagerInterface::createPager() it'd be nice to implement PagerManagerInterface::findPage() that calls through to the pager parameters service.
Actually the example code referes to a non-existing getCurrentPage()
method.
Steps to reproduce
Proposed resolution
Implement a PagerManagerInterface::findPage()
method. Wait for D10 not to break interface BC in D9.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#17 | interdiff-16.txt | 1.11 KB | Pooja Ganjage |
#16 | 3173636-16.patch | 3.43 KB | Pooja Ganjage |
#14 | interdiff-13.txt | 1.09 KB | Pooja Ganjage |
#13 | 3173636-13.patch | 3.43 KB | Pooja Ganjage |
#8 | interdiff_5_8.txt | 893 bytes | anmolgoyal74 |
Comments
Comment #2
alexpottI think we can do this under the 1-to-1 interface rule. Plus there are no classes implementing this in contrib according to http://grep.xnddx.ru/search?text=PagerManagerInterface&filename=&page=1
Comment #3
paulocsA patch for it.
Comment #4
alexpottComment #5
paulocsI added the tests.
Comment #6
paulocsInterdiff.
Comment #7
alexpottWe need to update the documentation. What's fascinating is that the docs already point to a PagerManager::findPage() method...
Anyhow this pseudo-code should be updated to use the pager.manager service.
Comment #8
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedUpdated the documentation as pointed out in #7
Comment #9
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedHi,
I am creating patch as per the given suggestion by #7 comments.
Please review the patch.
Thanks.
Comment #10
mondrake#8 is RTBC for me.
#9 has no interdiff and a change too much to docs IMHO.
Comment #12
catchI think we should type and return hint
int
with the new method.Comment #13
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedHi,
Creating a patch as per the #12 comment suggestion.
Please review the patch.
Thanks.
Comment #14
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedAttached interdiff for #13 patch.
Comment #15
mondrakeLet’s add an
int
typehint to the$pager_id
parameter too, thenComment #16
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedUpdated patch as per the #15 comment suggestion.
Comment #17
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedAttached interdiff for #16 patch.
Comment #18
Pooja Ganjage CreditAttribution: Pooja Ganjage at Asentech LLC commentedComment #19
mondrakelooks ok now thanks
Comment #20
catchThank you! Just needs a change record and release note snippet now.
Comment #21
paulocsI just create a change record. Can you please review it?
Not sure if it is enough.
Comment #22
catchThe CR could use a before/after example ideally - could be based on the change that'll be made in #3170185: Drupal\taxonomy\Form\OverviewTerms should determine the current page via the 'pager.manager' service, not from the Request.
Comment #23
paulocsHi Catch,
I just add the Before/After example to the CR.
Comment #25
catchCommitted a5789f3 and pushed to 9.2.x. Thanks!
Comment #26
catchThank you. The CR is enough here, don't think we need a release note, so untagging.
Comment #28
quietone CreditAttribution: quietone at PreviousNext commentedPublished the CR