The 620th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
Welcome to the latest issue of ProcessWire Weekly! In this week's issue we're going to check out what's new in the core this week, as well as share some highlights from the latest weekly update from Ryan.
In other news we've got a new third party module to check out, called GeoIP. This is a general purpose geolocation utility created by Maxim Semenov. And, as always, we've also got a new site of the week to highlight; this week that site belongs to Electronic Test & Power Systems, or ETPS, from the UK. Keep on reading for more details.
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 and a weekly update from Ryan
This week we've got a new weekly update from Ryan, in which he talks about some of the improvements that have just been applied to the WireHooks and HookEvent core classes, arguably one of the most critical parts of the core.
As Ryan explains in his post, these particular updates were made with help from an AI coding assistance Claude Code. Ryan was the one writing code, while Claude got to act as a pair programming buddy, making suggestions and double-checking the results.
Working with Claude Code reminds me of 1989 when I was in high school learning Turbo Pascal and building a BBS, and getting help from a neighbor and good friend that was doing the same. I learned so much then and now it feels like that time again.
— Ryan
Ryan is also currently experimenting with letting Claude take a more active role in our issues repository, figuring issues out and potentially also resolving obvious ones if and when that makes sense. And, for the record, this process is fully transparent: you can see from the comments on the issue if AI was involved.
WireHooks and HookEvent improvements
The full list of updates to the WireHooks class is quite long, but to summarize:
- WireHooks bug fixes, including one where hooks matching an argument might (e.g.
addHook('WireLog::save(=errors)')) would stop matching after first invocation, and$useHookReturnValuecould leak from one hook to another due to missing per-hook reset. - HookEvent bug fixes, including better argument handling in terms of null values, and various fixes for the __toString() magic method.
- New features for WireHooks, including support for string values "before" and "after" for cancelHooks to cancel hooks of a given type, and wilcard support for
getHooks('*')for getting all hooks for all objects. - New features for HookEvent, custom properties (
$event->customKey = $value) carrying on to subsequent hooks, allowing e.g. before hooks to pass data to after hooks easier than before,getCustomData()method for returning only custom properties, and each HookEvent getting a unique, sequential event ID ($eid) property.
There is also one bug fix outside the hook system, but still kind of related, resolving issue #2192 where LanguageSupport core module was hooking wrong internal method to Inputfield::setLanguageValue.
That's all for our core updates section this week. For more details, including the full changelog for the WireHooks and HookEvent updates, be sure to check out the weekly update from Ryan. Thanks!
New module: GeoIP
GeoIP is a new third-party ProcessWire module from Maxim Semenov. It has the ability to extract typical geolocation info — country, region, and city — from the IP address of a site visitor, and behind the scenes it uses MaxMind GeoLite2 database.
The module provides access to geolocation data via $geoip API variable, which means that you can tailor content based on this info, redirect users by default to a country-specific section, or perhaps set a default language for them. The module also has support for logging geolocation info in a custom database table, and comes with an (optional) widget that you can use to let users easily correct their location.
The API that the module provides is extensive, and has much more available than just geolocation info. For an example there are built-in methods for checking if a user is in specific country or city, or rendering content conditionally depending on geolocation:
// content for specific country
if ($geoip->inCountry('US')) {
echo $page->us_promo;
}
// content for specific city
if ($geoip->inCity('London')) {
echo $page->london_office_hours;
}
// conditional content; first paragraph if a match is found, second otherwise
echo $geoip->showIf(
'countryCode',
['DE', 'AT', 'CH'],
'<p>Kostenloser Versand ab 50€</p>',
'<p>International shipping rates apply.</p>'
);Check out the modules directory entry for more details and code samples. If you'd like to give this module a try, you can grab it from the GeoIP GitHub repository, or install it via the built-in modules manager in admin. Since some additional steps are required, be sure to check out the module's README or modules directory entry for instructions. For questions and support requests, head down to the GeoIP support forum thread.
Big thanks to Maxim for creating this module and sharing it with us!
Site of the week: Electronic Test & Power Systems
Our latest site of the week belongs to Electronic Test & Power Systems, a UK based company providing electrical power supplies and dynamic testing environments.
Today, ETPS provides one of the most complete ranges available. Working alongside multiple markets and sectors, our problem solving skills provide the spark for some of the world's leading technology brands to innovate.
— ETPS
The company began their journey as a test equipment division of Elba Electronics back in 1975, and became a stand-alone company in 1998. Today they offer a wide range of testing equipment, and work with clients in various business sectors — automotive and motorsports, energy storage and renewables, and aerospace and defence, just to name a few.
The website of ETPS was created by Castus and features an industrial type of design, definitely well suited for a company with as technical of a offering as ETPS has. The site has a variety of quality content available as well, providing a solid and in-depth look into the company and their offering, as well as plenty of information about their products. Having a proper product finder as a part of the site's header section is an interesting choice, and actually works really well.
As for some behind the scenes details, the front-end of this site appears to be largely custom-built, without the help of a full-blown front-end framework. Meanwhile, some of the non-core ProcessWire modules that we could spot in action include the commercial Pro module FormBuilder, and the free and open-source integrated view tracking solution Page Hit Counter.
Big thanks to Castus for sharing this project with us, and our congratulations to the client, Electronic Test & Power Systems, for their new, ProcessWire powered website!
Stay tuned for our next issue
That's it for the 620th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 4th of April. 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