In the 321st issue of ProcessWire Weekly we're going to check out the latest core updates, introduce two new third party modules, and check out a brand new site of the week. Read on!
Welcome to the latest issue of ProcessWire Weekly! In this issue we're going to take a closer look at the latest core updates, which again focus on improving the text search capabilities of the core, this time by providing support for the very interesting concept of word alternatives.
In other news we've also got a couple of new third party modules to introduce — both of them new Fieldtypes developed by Jürgen Kern — and a gorgeous new site of the week belonging to a digital agency from Kosovo, Fros Group.
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.
Latest core updates: introducing WireTextTools::wordAlternates() and the WireWordTools module
In this week's update Ryan shed some light on a new feature that was briefly mentioned in last week's core updates post: handling alternative words — plural forms and so on — in search queries performed via the API.
WireTextTools::wordAlternates() and the WireWordTools module
While ProcessWire has a very comprehensive API for finding content, one thing it hasn't so far been able to handle automatically are text searches where you might, say, search for content with the word "geese", but also want to match all instances of "goose". As of this week this feature is now, in a way, baked into the core:
- Using new hookable method WireTextTools::wordAlternates() it's possible to pass ProcessWire a list of alternative words for any given (searched for) word. This method is unopinionated, leaving implementation details to modules.
- Ryan has also released a new (non-core) module called WireWordTools that uses the hook method mentioned above, and provides word alternatives (i.e. plural, singular, etc. forms of given words) for English.
This feature applies to all page finding queries utilizing the query expansion support of full-text indexes — or, in other words, all queries that include the "+" sign in the search operator. Other queries are not affected.
Adding support for more languages?
The most important thing to grasp is that the core word alternates implementation is indeed unopinionated: without additional code it returns an empty array for all words. What this means in practice is that the core is not biased towards any single language, and thus it's possible to make it support practically any language out there.
Currently the only known implementation of this feature is the WireWordTools module, so if you'd like to add support to other languages, we'd recommend starting by taking a closer look at said module's code. There's also a pretty good chance that you might be able delegate most of the heavy lifting to some third party tool or library.
New module: Fieldtype ObjectDimensions
Fieldtype ObjectDimensions is a brand new module developed by Jürgen Kern. This Fieldtype and Inputfield combination was inspired by an earlier module called Fieldtype Dimensions, developed by Philipp 'Soma' Urlich.
From the point of view of a content editor this module provides separate inputfields for specifying the dimensions of a two- or three-dimensional object: one for width, another for height, and third (optional) one for depth. You can configure whether to use the third dimension, as well as set the unit, inputfield dimensions, max number of digits, and max number of decimals.
Moving on to the API side of things, you can obviously access the specified dimensions one by one, but that's really just the tip of the iceberg:
// accessing stored values: echo $page->fieldname->width; echo $page->fieldname->height; echo $page->fieldname->depth; // computed properties for volume and area: echo $page->fieldname->volume; echo $page->fieldname->area; // accessing the unit: echo $page->fieldname->unit;
There are also built-in rendering methods for the dimensions, volume, and area, and you can use each specific key in selector strings. Overall this is really comprehensive module for all use cases where you need to specify dimensions for an object, whether two- or three-dimensional one.
For more details and examples, be sure to check out the Fieldtype ObjectDimensions GitHub repository. Thanks to Jürgen for building this module and sharing it with us!
New module: Fieldtype SimpleAddress
Another new module released just this week is Fieldtype SimpleAddress, this one also developed by Jürgen Kern. This module provides predefined inputfields for storing address data: street name, house number, postal code and postal address, etc.
The API of Fieldtype SimpleAddress provides access to all the defined properties, as well as coordinates (if defined). You can configure which inputs should be required, and choose whether to display the coordinate fields.
Since this module is indeed intended as a relatively simple tool, there's no built-in logic for automatically geocoding addresses; if you want to store coordinates, you need to set those manually — or handle it automatically by hooking into Page save process or some other applicable step in the process, but that's already out of the scope of this module.
Again big thanks to Jürgen for sharing this module with us — very useful!
Site of the week: Fros Group
Our latest site of the week belongs to Fros Group — a digital agency from Kosovo. The services provided by Fros Group include web design and development, eCommerce projects and digital branding, and their own website is one of the latest additions to our sites directory.
The bulk of the content on this multi-lingual website is authored in English and Albanian, and design wise the Fros Group site is quite a stunner: there are a lot of carefully thought out content elements, typography is beautiful, and there's definitely no shortage of different animations and transitions — from transitions between pages all the way to slide-in elements and pointer effects.
While we can't say much about what's going on behind the scenes here, the front-end of this site is another deal: it's a slightly customized version of a prebuilt theme — one called Droow — with bespoke content and various modifications to better suit the Fros Group look and style. Overall prebuilt themes are not something we come across very often, but there's definitely a market for this type of project as well.
Thanks to Fros Group for sharing their site with us, as well as trusting ProcessWire for their client projects. Keep up the great work!
Stay tuned for our next issue
That's all for the 321st issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 11th 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!