ProcessWire Weekly #323

In the 323rd issue of ProcessWire Weekly we're going to cover the latest core updates, introduce some highlights that can be found from the next release of the commercial ProCache module, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly! In this week's issue we're going to check out the latest core updates, list some highlights from the soon-to-be-released new version of ProCache, and introduce new third party module called Openinghours.

Last but not least, our latest site of the week belongs to a Finnish boat hotel service, Inkoon Venehotelli. More about that in just a bit!

Thanks to all of our readers for being here with us again, and as always, any feedback is most welcome – please don't hesitate to drop us a line if there's anything in your mind you'd like to share with us. Enjoy our latest issue and have a great weekend.

Latest core updates: new hooks, and some news on an upcoming ProCache release

In the latest weekly update post at the support forum there's a personal message from Ryan — about spending the summer with kids, upcoming school year, and all that stuff happening outside the ProcessWire project, as well as some that's happening within it.

This week Ryan also had some core update news to share — most of which we'll cover in this post as well — and finally there's a whole list of interesting stuff to expect from the upcoming ProCache release.

New Pages object hooks in the core

The core updates this week involve a set of new hookable methods in the Pages class:

  • Pages::trashReady(): called when a Page is about to be trashed.
  • Pages::deleteBranchReady(): called before a branch of pages is about to be deleted, called on root page of branch only.
  • Pages::deletedBranch(): called after a a branch of pages has been deleted, called on root page of branch only.

These new hooks provide additional control over actions performed right before a page is trashed, as well as right before and after a branch of pages is deleted. Delete branch hooks are particularly handy, and the soon-to-be-released ProCache release will no doubt make good use of them.

New ProCache version, and a brand new companion module called ProCacheCrawler

It looks like the next ProCache update will be a major one. According to Ryan, a lot of the code has been refactored and reorganized, there will be optimizations and smaller fixes here and there, and of course a bunch of new and improved features are going to make their way into the module as well.

Here are some of the highlights we've been made aware of so far:

  • There will be a new version of the .htaccess rules, intended to take up a lot less space, particularly if your site happens to work for multiple hosts, schemes, or extensions.
  • There will also be an option to use either v1 or v2 of the htaccess rules, and the module will make enabling these htaccess rules easier than before by creating a htaccess example file for you.
  • There's going to be a built-in URL testing tool, which you can use to compare the rendering times for non-cached and cached pages.
  • New configuration options will include a setting for specifying how pages served by ProCache will respond to trailing vs. non-trailing slash URLs, more options for configuring cache lifespan and cache clearing rules, and more.
  • Bundled SCSS and LESS compilers will get updates.

On a few occasions Ryan has mentioned his plans to a feature for crawling the site and priming the cache. This feature is on the works, but has now been split into a separate module called ProCacheCrawler, which — once it's ready — will also be available to download for ProCache customers.

For more details, check out the weekly update from Ryan. Next version of ProCache should be out in a matter of days, so if you're already a ProCache user, you'll soon be able to give it a try yourself!

New module: Fieldtype Openinghours

Fieldtype openinghours is a brand new third party module, developed by Jürgen Kern. This is an inputfield and fieldtype combination intended for storing opening hours, or any set of time that should be defined on a per-weekday basis — show dates, course times, and so on.

The inputfield part is a laid out as a table of days and times. Each day (mon–fri, with an addition of holidays) can contain one or more times, the max number of which you can configure via field settings. The GUI is dynamic — new rows are added on the fly — and there's both frontend and backend validation: duplicate and invalid times are removed, times are sorted automatically, etc.

The admin GUI of the Openinghours module. Screenshot by Jürgen Kern.

One thing that makes this module particularly interesting is the comprehensive API it provides. There are numerous ways to get to the times once they've been saved in the field, some of which take additional params for even more control over output:

  • $page->fieldname->times: get unformatted data array with days as keys, and each value being an array of start and finish times.
  • $page->fieldname->getTimes(): same as previous, but each day containing formatted values as defined via configuration settings.
  • $page->fieldname->times['mo'] get opening hours of a specific day without output formatting. Returns an array of start and finish times.
  • $page->fieldname->getTimes('mo'): same as above, but with output formatting enabled. Time format can be defined via configuration settings.
  • $page->fieldname->combinedDays(): get combined opening hours, with days that have exactly the same opening hours bundled together.
  • $page->fieldname->render(): render opening hours for all day. Takes an optional array of output settings: list class, full or short day names, separator, etc.
  • $page->fieldname->renderDay('mo'): render opening hours for one day (with an optional array of output settings).
  • $page->fieldname->renderCombinedDays(): render combined opening hours (with an optional array of output settings).

All in all this is a very comprehensive module, and should easily handle most opening hour related needs you'll typically come across. Also, if you'd like to see this module in action before giving it a try, there's a video of the admin GUI available via the Fieldtype Openinghours upport forum thread — be sure to check it out.

Big thanks to Jürgen for developing this module and sharing it with us, truly splendid work! For anyone who'd like to give it a try, you can download or clone the module directly from the Fieldtype Openinghours GitHub repository.

Site of the week: Venehotelli

Our latest site of the week belongs to a Finnish company called Inkoon Venehotelli Oy. Founded in 2020, the company is based on Inkoo, Finland and provides boat storage and maintenance services for their clients. Their newly released, ProcessWire powered website was built by Timo Anttila.

This site, the content of which is authored in Finnish only, features a nice and clean design with some nifty little details, such as an animate-on-scroll propeller on the top bar. First and foremost, though, the design is straightforward and easy to follow: there are very few unnecessary elements, content is easy to consume, and the overall look and feel is very much "to the point".

As for behind the scenes details, this site makes use of the AIOM+ module, and on the front-end side there are some familiar JavaScript libraries — including jQuery and Slick — but no full-blown front-end framework. Instead, it looks like the site is based on the same home-brewn solution we saw in the Quje site by Timo that we featured in #304.

Big thanks to Timo for sharing this project with us, and our congratulations to the client, Inkoon Venehotelli. Great stuff!

Stay tuned for our next issue

That's all for the 323rd issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 25th of July. As always, ProcessWire newsletter subscribers will get our updates a few days later.

Thanks for staying with us, once again. Hope you've had a great and productive week, and don't forget to check out the ProcessWire forums for more interesting topics. Until next week, happy hacking with ProcessWire!

Post a comment