Eighth issue of ProcessWire weekly. Another batch of core updates and a couple of very interesting new modules to introduce this week. Read on!
Last time I posted a little questionnaire for you folks. You'll find a list of submissions received near the bottom of this post. Some of the ideas were new (at least to me) and others were features requested and discussed before, but all were equally appreciated.
If you still want to throw an idea or two, the form is waiting for you in last weeks post. Thanks for your input – and most of all, thanks for all of you who posted your ideas last time!
New page level language methods
In addition to various minor improvements, there were two pretty big core updates this week, one for multi-language features and another for image and file fields.
First of all, new page level methods getLanguageValue() and setLanguageValue() were added in this commit to provide a common interface for all actions related to getting and setting values of multilingual fields:
// assuming that 'title' is multi-language field and language 'finnish' exists,
// this outputs the value of field 'title' in Finnish for current page:
echo $page->getLanguageValue('finnish', 'title');
// this replaces current Finnish value of 'title' with 'Tämä on sivun otsikko':
$page->setLanguageValue('finnish', 'title', 'Tämä on sivun otsikko');
How easy is that? Now that there's a solid interface for all multilanguage values, there's no need to wonder how those should be handled. Definitely a welcome update!
Improvements to image and file fields
Another big update for this week – or a set of updates really – was for image and file fields. Changes introduced in this commit were largely targeted for making trivial template-level tasks even more trivial and controlling the input and output values of said fields:
- Type of return value can now be defined separately from max number of files; multi-value field can return a single item (first one) and single-value field can return array of value(s)
- New rendered string option allows field to output markup directly; output markup is fully customizable on a per field basis
- New default value opiton makes it possible to define a page to fetch field value from while it's empty for current page
- Description field can now make use of any available textformatter, not just the entity encoder like it used to
Last but not least, it's now possible to specify minimum width and height for images in a similar way as maximum values. For earlier ProcessWire versions ImageMinSize by Soma achieves exactly the same thing, but this is definitely something we've been waiting to get into core itself.
Want to get a sneak peek into upcoming ProcessWire 2.5?
The release date of ProcessWire 2.5 is approaching, but you shouldn't hold your breath just yet; that's probably still going to take a while. Meanwhile in one of his recent posts Ryan explained current state of the dev branch and pointed out that some of us are already using it for new projects.
While updgrading a top-priority production site to dev probably isn't such a great idea quite yet, if you're just starting a new project or have a non-critical project of your own, dev branch might be just the right choice for you. It's more effective performance-wise, has tons of great new features.. and once 2.5 hits that stable milestone, you'll be up to speed instantly.
There's absolutely nothing wrong with taking it slow and waiting for the stable release, but if you do decide to try out the new features – please let Ryan know how well it behaves by submitting any problems either on the forum or as GitHub issues.
Invented by Antti, built by Ryan and sponsored by Avoine: Dynamic Roles
If you've worked on complex sites you're probably familiar with issues related to managing permissions, granting users just the right amount of access etc. While ProcessWire's built-in template-level access control is enough for most sites, new Dynamic Roles module cranks the volume up to eleven when it comes to role-based access control.
The concept is that, in addition to still being able to define permissions at template level, you can also create so-called "dynamic roles" which are applied for users run-time based on specific criteria (such as their names, email addresses, custom field values etc.) and add new permissions to those users only.
This is best explained by Ryan and the screenshots he's posted at the ProcessWire forum thread for the module, but trust me: this thing is going to be a real gamechanger for a lot of sites! I'd go as far as say that it's even more powerful than the page-based permissions module published a while ago.
Just a few years ago access management in ProcessWire could've been be described as "simple" (in both good and bad), now we've got such a set of features in this regard that no other system I've ever used can do the same. That's some impressive development right there!
Template Engine Factory by Wanze
Template Engine Factory is a brand new module that implements pretty neat MVC-ish concept by turning ProcessWire template files into controllers and using separate files for output. Main driver behind this project is separation of concerns – keeping so-called business logic in one place and anything that generates markup in another.
Many experienced develoeprs have already bent ProcessWire to do something similar, but the way Wanze has implemented it for his module makes it available for just about anyone, regardless of level of experience. Even if "MVC" is a entirely new concept to you, you'll grasp the basics very quickly with this module.
For those of you who consider a template engine a must-have feature, check out Twig for Template Engine Factory and Smarty for Template Engine Factory, which (as the names suggest) add support for Twig and Smarty for Template Engine Factory.
There are couple of different approaches and even modules providing similar capabilities, but this one still looks pretty neat to me. Congratulations to Wanze for a job well done – hopefully we'll be seeing a lot of new development for this concept in the near future!
Quick glance into the ideas provided via last weeks questionnaire
First of all, huge thanks to everyone who contributed their ideas! The thing about free software that always intrigues me is a community that can provide both support and ideas for further evolution of the solution itself – definitely something that ProcessWire shines in.
This is intended as a quick glance into the ideas posted via our questionnaire – I've made an attempt at gropuing them into logical sections and left some details out to keep the list clean, but all your comments were definitely noted:
Improvements to admin tools
- Force deletion of templates and fields, even if they are currently in use, possibly with an option like "delete pages / replace with another template"
- Improvements to profile exporter (including export of users and proper multilanguage support), way to choose a profile in the ProcessWire installer
- Improvements to file upload in general, including support for uploading really large files in chunks (Plupload, Fine Uploader) to avoid timeouts
Potential module ideas
- Improved cropping features, including advanced features like focal point cropping (Focal Point, CropUp)
- One-click backups and corresponding restore feature (potentially for deploying on another locations too)
- Generic tools for eCommerce integration; easy way to embed payment buttons (Klarna, Stripe, PayPal)
- Improved mapping tools (e.g. some sort of Google Maps drawing library)
- Site-wide media manager
General and/or core level improvements
- Improvements to current .htaccess file based on what other projects (e.g. HTML5 Boilerplate) are already doing
- Support for fuzzy searching (smd_fuzzy_find, approximate/fuzzy search in PHP, SOUNDS LIKE / SOUNDEX())
- Increase in social media activity
- Active blog/news section on processwire.com
(There was also one request for "teaching ProcessWire to brew coffee", but unless someone knows of a working implementation of RFC2324, I'm afraid we'll have to let that one go. Great idea, though!)
Site of the week is update.ch
This site was apparently launched just a few days ago and belongs to update AG, an internet communications agency (hope I got that right, my German is a bit rusty..) based in Zürich, Switzerland.
As if it wasn't enough that Soma is the one who presented this site on the forum, the site also works nicely on a plethora of devices, is a real treat for eyes and packs more than it's fair share of neat tricks from rather unique navigation to lazy-loading images etc.
Soma (and whoever else worked on this one) – great job!
Stay tuned for our next issue
This issue was absolutely packed with new features and I hope you've enjoyed reading it. That's it for now, we'll be back next week with all new topics.
Issue #9 will be out Saturday, 12th of July. Until then, happy hacking with ProcessWire!