Jump to content

Recommended Posts

Posted

I'm working on adding a Webmention Manager to my module, using Comment Manager as the basis. I'm still on PW 2.5.3 and trying to build the module to work on 2.5+ (the only reason I haven't upgraded yet). I realized that the PaginatedArray class isn't in the 2.5.3 code, so was going to add backcompat code to the module. I was wondering when the PaginatedArray class was added to core, but having a hard time determining that. Is there an easy way to find out, short of searching through each of the version tags on Github? Perhaps the doc parameter @since could be added to the doc comments, so I could tell by looking at the master branch?

While on the topic, is the best way to include such backcompat to check for the existence of the class and then include it if it doesn't exist?

Edit: Hmm, so I'm realizing that the updates adding PaginatedArray and WirePaginatable go deeper than I expected. For example, I cannot use the MarkupPagerNav because it expects a PageArray input, not my WebmentionArray (which implements WirePaginatable). Perhaps it's best to just make my module 2.6+, unless someone has some good advice for backwards compatibility.

Posted

I'm not sure how deep this issue goes, but fixing the pagination module issue can be quite easy.

$pa = new PageArray();
$pa->setTotal($total)->setLimit($limit)->setStart($start);
$pager = $this->modules->get('MarkupPagerNav');
$pager->baseUrl = $baseUrl;
$pager->render($pa);
  • Like 2
Posted

I was wondering when the PaginatedArray class was added to core, but having a hard time determining that. Is there an easy way to find out, short of searching through each of the version tags on Github?

Might not be relevant anymore, but still wanted to answer this particular question. To find out when PageinatedArray.php was added to the core, open the file in GitHub, click "History", find the applicable commit (in this case the first one), and click the "< >" link next to the commit number ("browse the repository at this point in the history").

This is probably the easiest way to browse the repository at given point in time and check applicable ProcessWire version from /wire/core/ProcessWire.php or whatever else you might require. For tracking more specific changes you'd use "Blame" instead of "History" to find the commit and then hit "Browse files" from the top right corner of the commit message :)

  • Like 1
Posted

Thanks for that PageArray trick. That works great and I think I can keep 2.5+ support. And thanks for the Github info!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...