ProcessWire Weekly #49

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

Welcome to the 49th issue of ProcessWire Weekly – hope you're doing fine and have had a good week. Now it's time to grab a cup of coffee and browse through our weekly ProcessWire updates.

This week we've got some very exciting core updates to share with you, and a new online tool that will literally change the way you work with ProcessWire modules. There's plenty of stuff to go through, so without further delays, let's get this thing started!

Latest ProcessWire core updates (2.5.27)

This week Ryan has brought in a downright stunning list of new – and improved – features, which we'll try to cover here as briefly as possible. For more details, usage instructions, etc. visit Ryan's latest post at the processwire.com blog.

In addition to the features listed here, a whole bunch of issues were closed this week. In fact, in his post Ryan mentions that there are no known major issues left in the development branch, which is a good sign that we're very close to the 2.6 release date!

Here's the complete list of updates introduced this week, summarised from Ryan's blog post linked above:

  • When a new field is created, use any existing field as a starting point.
    This is mainly a workflow improvement since an identical feature has been available for a while in the form of cloning an existing field via the Actions tab in its settings view.
  • Support for "notes" has been added to fields.
    This is another feature that has existed for a long time, but until now it's only been accessible via the API. Now you can define "notes" – which will be displayed right below the fields – for any field right from the field settings, just like "description" and "label".
  • A whole lot of API improvements for ProcessWire's array types.
    • New each() method is similar to the each() method in jQuery, and essentially makes iterating WireArray items and performing tasks on them a very streamlined experience: $items->each(function($item) { ... }).
    • Getting properties of all items in a ProcessWire array is now just one function away: $pages->find('template=basic-page')->title(', '). This works with all fields, and if a separator string is given as an argument, values are returned as a string – otherwise an array is returned.
    • The explode() method now has support for requesting an associative array of multiple, selected properties for each item in a ProcessWire array:
      $data = $items->explode(array('url', 'title', 'summary')); .
  • Configuration updates for modules, fieldtypes, and inputfields.
    • Configuration settings for modules can be defined as an array directly within the module file itself using new getModuleConfigArray() method.
    • Similar to module configuration, inputfields and fieldtypes now also have the support for defining their configuration options as an array.
    • Module configuration methods can now choose to be static or non-static, depending on what makes most sense for that particular module.
  • If you're already using PHP 5.6, you'll be able to benefit from the new __debugInfo() feature.
    In a nutshell, this allows you to use PHP's print_r() for debugging ProcessWire objects without receiving a huge blob of nonsensical data in return. This feature is likely to be refined further, but the support is there already.

ProcessWire Module Generator, new must-have tool for ProcessWire module authors

ProcessWire Module Generator, the latest project by Nico Knoll, is a web-based tool for generating module skeletons for ProcessWire.

The settings and options you'll have to consider when setting up a new module can feel a bit overwhelming – especially if you're just getting started with module development itself – and that's exactly what this tool does for you. There's a GUI for just about everything you'll need to configure, and helpful FAQ and Best Practices sections for more tips and tricks.

Building a new module used to be a three-step process: grabbing an existing module (preferably of same type and somewhat similar features) as the starting point, removing existing code (and other details), and finally filling in your own stuff. ProcessWire Module Generator streamlines this workflow by skipping the first two steps entirely, and giving you a head-start for the third one by letting you fill in quite a few module-specific details via a simple GUI.

You can start using this tool right now at modules.pw. For more details and support, visit the support thread at the ProcessWire support forums. Huge thanks to Nico for the idea and implementation of ProcessWire Module Generator!

Simple validation for POST data with the Validator module by Bea Dav

Validator is a brand new module by Bea Dav. The approach of Validation is likely to be familiar for those with prior experience with validation components from other frameworks – just for an example it's API is very similar to the one you'd find from Zend Framework.

Here's a slightly trimmed-down version of one of the example you'll find in the module's docs, showcasing some of the features of this module:

$validator = new Validator;
$validator->setConfig(array(
  'username' => array(
    'isEmpty',
    'isUnique' => array('ident' => 'name', 'sanitize' => 'username'),
  ),
  'pass' => array(
    'isEmpty',
    'minLength' => array('min' => 6),
    'containsAtLeast' => array('contains' => 'digit, letter'),
    'noWhitespace',
  ),
));

if (!$validator->isValid()) {
  $errors = $validator->getErrors();
  $errorMessages = $validator->getMessages();
}

For more usage examples, take a look at the Examples.md. The docs this module ships with are quite extensive, and quite helpful – and, of course, there's always the support board at the ProcessWire forums for questions not answered directly in those docs.

Thanks to Bea for sharing this module with us! While this may not the first validation module for ProcessWire, it's a very clean solution, and having options isn't bad either!

Site of the week: Canton Speakers

Founded in 1973, Canton is the largest manufacturer and developer of best-selling speakers in Germany. Their product catalog is very extensive, and everyone from experts to consumers seems to agree that they're one of the top companies in their field of expertise.

Their site is powered by ProcessWire and was designed and built by actualize, a web design and e-commerce studio with a very impressive portfolio of both services and references. The site is responsive, feels easy to use, and has a sensible content architecture – which is pretty much a necessity for a site showcasing such a vast collection of products after all.

Overall this site is a great example of ProcessWire's flexibility and ability to cater for large and data-intensive sites. Thanks to actualize for building and sharing it with us!

Stay tuned for our next issue

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

This post has 1 comment:

Pekka @ developers.fi on Friday 24th of April 2015 14:15 pm

Kiitos näistä :)

Post a comment