ProcessWire Weekly #534

In the 534th issue of ProcessWire Weekly we'll cover the latest weekly update from Ryan, check out a brand-new third party module called Fieldset Helper, and more. Read on!

Welcome to the latest issue of ProcessWire Weekly. In this week's issue we're going to kick things off by digging into the latest weekly update from Ryan, in which he shares some details about a new fieldtype module he's been working on. Said fieldtype goes (at least for now) by the name Custom, and essentially allows one to configure a field based on a JSON or PHP based configuration file.

In other news we've got a newly released third party module to check out: Fieldset Helper, created by Robin Sallis. And, as always, we'll also highlight a new site of the week. This week that site belongs to iDR Coaching, which is an online coaching programme for mental strength, fitness, and weight loss.

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!

Weekly update from Ryan

The latest weekly update from Ryan, posted to the ProcessWire support forum, provides an early look into a new fieldtype module that Ryan has been working on based on a customer project requiring a very large number of custom fields to be created. Said fieldtype goes by the name "Custom", at least for now.

Custom field structure defined in JSON or PHP

While there are already fieldtypes that can support a custom subfield structure, such as commercial Table and Combo fields, the main difference is that with Custom one would define the field's structure either using a JSON file, or a PHP based configuration file. As such, this fieldtype bears some similarities with the third party Mystique fieldtype, and also with the RockMigrations module.

Anywho — whichever syntax you choose to use, the field definitions within said config file must follow the Inputfields API schema. Here's an example of what that might look like in practice for a simple contact info field:

{
    "first_name": {
        "type": "text",
        "label": "First name",
        "required": true,
        "columnWidth": 50
    },
    "last_name": {
        "type": "text",
        "label": "Last name",
        "required": true,
        "columnWidth": 50
    },
    "email": {
        "type": "email",
        "label": "Email",
        "placeholder": "[email protected]",
        "required": true
    }
}

Custom field appears as a collection of regular fields in the admin, and once populated, the values are accessible via a WireData object — or, in other words, you'll access them just as you would access any other field with subfields. For the field structure defined above, assuming that it is for a field called "contact", it could look like this:

<h1>
    <?= $page->contact->last_name ?>, <?= $page->contact->first_name ?>
</h1>
<p>
    <a href="mailto:<?= $page->contact->email ?>">
        <?= $page->contact->email ?>
    </a>
</p>

Custom field is not yet finalized or available — we'll let you know once that happens. In the meantime be sure to also check out the weekly update from Ryan for more details, such as screen captures, PHP configuration examples, and code samples. Thanks!

New module: Fieldset Helper

Fieldset Helper is a brand-new third party ProcessWire module created by Robin Sallis. As Robin explains in the forum thread introducing this module, it was created mainly to overcome what he describes as shortcomings of Fieldset and FieldsetPage fields:

  • The module adds support for visibility options "Open when populated + Closed when blank" (along with its "AJAX" and "locked" variations) and "Open when blank + Closed when populated" for Fieldset and FieldsetPage fields.
    • Note: as of this writing the AJAX option doesn't yet work for FieldsetPage.
  • The module also adds a new method FieldtypeFieldsetOpen::getFieldsetFields(), which you can use to get all the fields that have been nested within the fieldset.

As Robin also mentions in the post introducing this module, aforementioned features have been raised in the processwire-issues GitHub repository, and could be eventually handled directly by the core. For the time being, though, you can get them simply by adding this module on your site.

If you'd like to give the Fieldset Helper module a try, you can clone or download it from the FieldsetHelper GitHub repository.

Big thanks to Robin for creating this module and sharing it with us!

Site of the week: iDR Coaching

Our latest site of the week is that of iDR Coaching, which is an online coaching programme for mental strength, as well as fitness and weight loss coaching. The coach behind iDR Coaching is certified nutritionist and qualified fitness trainer Marvin Ilius da Rocha.

[iDR Coaching] takes a holistic approach with individualised nutrition and training plans and is accompanied by certified nutritionist and qualified fitness trainer Marvin Ilius da Rocha, who is there for his clients around the clock as a personal trainer and coach.

— Sites directory entry for iDR Coaching

The iDR Coaching website was created by flipzoom; Media. While not a massive site, there's still plenty of well organized information for potential customers, and the site also boasts a clean and modern design with various animated effects and stunning typography. Content wise this site is split into a section covering available services in great detail, an about section introducing the coach behind iDR Coaching — personal profile, his merits, and the fundamentals of his coaching style — and a contact page.

As for behind the scenes details, the front-end of this site appears to be custom-built, with some familiar dependencies, such as jQuery, picturefill, lazysizes, and JavaScript animation library GSAP. When it comes to ProcessWire modules, there are a couple that we could spot, both commercial Pro modules from Ryan: caching and optimization tool ProCache, and the general purpose form management tool FormBuilder.

Thanks to flipzoom; Media for sharing this project with us, and our congratulations to the client, iDR Coaching, for their new, ProcessWire powered website!

Stay tuned for our next issue

That's all for the 534th issue of ProcessWire Weekly. We'll be back with more news, updates, and content Saturday, 10th of August. 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