ProcessWire Weekly #135

The 135th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!

This week the built-in Repeater field has received some pretty notable new features and improvements. In this issue we've also got a brief introduction to a new module called Admin Actions, a new recipe of the week, and of course a brand new site of the week.

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: ProcessWire 3.0.44, Repeater and Repeater Matrix upgrades 

In his weekly post at the blog Ryan introduces the latest development version of ProcessWire, 3.0.44. This version focuses on the built-in Repeaters and, since they share a lot of functionality, also the commercial Repeater Matrix fieldtype:

  • Individual repeater items can now have depth, meaning that you can build a hierarchy between individual repeater items: parent items, child items, etc.
  • New accordion mode forces only one repeater item open at any given time.
  • Maximum and minimum quantity of repeater items is now configurable.
  • New GUI features for cloning individual repeater items and deleting all existing items. Both features are accompanied by vex powered confirmation dialogs.
  • Support for toggling all repeater items open/closed by double-clicking the on/off toggle. Please note that this particular feature is still somewhat experimental.

In addition to the strictly new or updated features, the JavaScript related to Repeaters have also been largely rewritten, and some UI related quirks have been fixed. All in all this has been a great week for Repeaters!

For more details about this week's core updates, including a screenshot and some code examples related to the newly added repeater item depth feature, don't forget to check out Ryan's latest post at the blog. Thanks!

New module: Admin Actions

Admin Actions is a new Process module built by Adrian Jones. In a nutshell this module provides a shared dashboard for a collection of reusable admin actions. Behind the scenes each admin action is a class that performs a specific task.

The module comes with a collection of predefined admin actions for various common tasks: for deleting unused fields or templates, copying the content from one field to all the pages using a specific template, finding and replacing field values, and so on. Each action is a class with a specific structure, and you can easily add your own actions too.

For more details about this module and a comprehensive list of the predefined actions bundled with it, please visit the Admin Actions support forum thread. You can grab the module directly from GitHub or use the built-in module manager to install it.

Big thanks to Adrian for sharing yet another useful module with us!

Recipe of the week: define your own, global helper functions

With this week's recipe we're going back to the basics by explaining how you can easily define your own collection of utility functions and use them everywhere on your site. It's worth mentioning that there's no module development, core modifications, per-template includes or anything of the sort required for this recipe.

This recipe is a slightly modified version of the best way to implement a global utility function recipe found from the ProcessWire Recipes directory. Big thanks to Horst for submitting the original version of this recipe!

The problem

Some of the other frameworks out there have a bunch of utility functions available right out of the box – you know, things like h($str) as a shortcut to htmlspecialchars($str, ENT_QUOTES, 'utf-8') or antispambot($email) for converting email addresses to HTML entities. Such functions can make your life a bit easier and also help you stay DRY.

While ProcessWire has a few common utility functions of its own, for the most part it stays out of such things. First of all many features like that would only be useful to a small subset of our users, and second of all we want to avoid introducing something that could essentially evolve into our own templating language.

The solution

Probably the most straightforward solution to this problem would be bundling your own utility functions into a PHP file and including that file in your /site/config.php file. For the sake of this example, let's say that your functions are within /site/functions.php. This is how you would include it in your site config file:

include_once(dirname(__FILE__) . "/functions.php");

This way you can use the features/methods in this file everywhere on your site. Since the site config file is loaded very early in the boot up process, you can use these features as well in template files as in modules, etc.

As a matter of fact, since the site config file is a regular PHP file and not just a static .ini or .xml file, it opens up a whole bunch of pretty neat possibilities. You can include any number of additional files within the config file itself, use PHP code to define dynamic configuration settings, and so on. Pretty neat, right? :)

This week's recipe was borrowed from the ever growing ProcessWire Recipes directory and originally submitted by Horst via a support forum post. If you've got a recipe of your own that you'd like to share with others, feel free to submit it at ProcessWire Recipes.

Site of the week: Spencer Estate Agents

Our latest site of the week is a real treat: Spencer Estate Agents, a company based in Sheffield, England. Taking both the design and the content into account this is easily one of the richest and most beautiful sites we've come across lately, and thanks to its responsive design it works wonderfully on all sizes of screens.

In the post announcing this site Tom shared the fact that some of the data you see on this site comes from another system known as Venga, gets imported to ProcessWire as regular pages, and thus is made available via ProcessWire's own API. Integrations are always fun, particularly when you're working with a system like ProcessWire that makes fetching and importing data just about as easy as it can get.

Other potentially interesting, techy details on this site include the use of ProCache and CloudFlare CDN to speed up the site, and a simple Mailchimp subscription form in the footer area. The front-end of the site is powered by the Uikit front-end framework and GreenSock GSAP, among other things.

Big thanks to Tom for sharing this site with us, and congratulations to both Spencer Estate Agents for having a wonderful site and Peter & Paul for building it for them – always happy to see a new ProcessWire project with a great outcome!

Stay tuned for our next issue

That's it for the 135th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 17th of December. 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