ProcessWire Weekly #578

The 578th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, 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 checking out the latest core updates and sharing a few quick updates from the admin theme discussion going on at the support forum.

In other news we're going to take a quick look at the latest addition to the ProcessWire modules directory, Wesanox Framework Package. And, as always, we've also got a new site of the week to highlight — this week belonging to Katholisches Kreisbildungswerk Freising e. V., a non-profit education center located in Freising, Germany.

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

Lately the focus of core development has been, in one way or another, on the recently released new look for our default admin theme, Admin Theme Uikit. This week is no different, and we have a few related updates available via the ProcessWire dev branch at GitHub:

  • Admin will now use light theme by default. Auto mode and dark mode are still readily available (unless specifically disabled), but as the dark mode is undeniably somewhat experimental and may result in quirks especially in combination with third party modules utilizing Uikit features that the core itself doesn't use, defaulting to light mode makes more sense while we're working on improvements.
  • Another newly added feature that is now disabled by default are toggle-style checkboxes. While the toggle style can be a nice visual upgrade, it doesn't necessarily make sense for everyone and everywhere. At least for now it seems like the best middle ground to leave it in but make it an optional feature.
  • For improved control, sites and modules now have a way to disable dark mode by calling $config->AdminThemeUikit('noDarkMode', true), and disable the toggle style by calling toggle style checkboxes via $config->AdminThemeUikit('noTogcbx', true).

Regarding that last update, this can be done in the context where it makes most sense. Here's how Ryan explains it on the support forum:

These options above can be set globally or on a per request basis. For instance, if you want to limit the “no dark mode” option to just when your Process module runs, then you could set it from your Process module’s execute() method. If you wanted to disable it for all requests, you could set it from an autoload module’s ready() method or directly in your /site/config.php file.

Another thing from the post by Ryan that we'd like to highlight is this note about how the new look will likely be handled for existing sites, once it is eventually merged into the stable/master branch:

The main/master branch will keep existing installations on the Original theme. But on the dev branch, I think we have more room and I didn’t think most would know about it unless they were in our small regular group of people that visit here. We want to encourage those on the dev branch to use and help test it.

In other news we are — at least according to current plans — not going to forcibly migrate any existing sites to use the new look. As Ryan has also stated, the "original" Uikit admin theme will remain available for foreseeable future, so those that enjoy it more than our new look will be able to keep using it. There are no plans to deprecate or sunset the original look.

If you'd like to hear more about the admin theme, be sure to check out the "new blog: admin theme redesign" forum thread. And if you haven't yet checked it out, we'd definitely like to suggest reading what Jan Ploch, a designer at KONKAT Studio, has to say about the goals, process, and ideas that went into the new admin theme style.

That's all for our core updates section this week. Thanks!

Introducing ProcessWire JSON API

This week we're going to take a quick sneak peek at a brand-new third party project, although still very much in development, is looking very promising: ProcessWire JSON API. Created by Ville "Fokke" Saarivaara, this PHP library — not a module, mind you — provides an easy way to set up a full-featured JSON API for a ProcessWire site.

While there are many ways to achieve this type of thing, here are some highlights for ProcessWire JSON API in particular:

  • It is easy to get started with. Technically all you need to have a functioning API endpoint is to install the project, create a class for your first API endpoint, and instantiate the API in your site's init.php or ready.php file.
  • It was built to scale with your needs, supporting multiple API instances, multiple service stacks, and service-wide request hooks.
  • It has built-in support for things commonly needed when working with headless ProcessWire sites, such as the Page Parser for converting ProcessWire pages into structured data that is ready to use in API responses.
  • It is based on some of the latest and greatest features of ProcessWire and PHP: under the hood ProcessWire JSON API makes use of URL hooks, a relatively new addition to the core, and utilizes many modern PHP best practices and features, including strong typing, enums, traits, and generators.
  • It comes with a test suite. If you've been working on ProcessWire projects for a while, you'll likely be aware how rare that actually is.

Getting started with ProcessWire JSON API is covered in more detail in the docs, but here's what it could look like. First we'll need to implement a service, which is essentially a collection of API endpoints for your project — in this case we're implementing just a simple example service with a single API endpoint:

<?php namespace ProcessWire;

// /site/services/HelloWorldService.php

use PwJsonApi\{Service, Response};

class HelloWorldService extends Service {
    public function __construct() {
        parent::__construct();
        $this
            ->addEndpoint('/hello-world')
            ->get(function () {
                return new Response([
                    'hello' => 'world',
                ]);
            });
    }
}

Once the service has been defined, you can instantiate the API in e.g. /site/ready.php:

<?php namespace ProcessWire;

// /site/ready.php

require_once './services/HelloWorldService.php';

$api = new PwJsonApi\Api();
$api->setBasePath('/api');
$api->addService(new HelloWorldService());
$api->run();

Now that you've set everything up, sending a GET request to your your site with a path /api/hello-world/ — or simply opening it in the browser — should result in a JSON response. If this is the case, you've just successfully configured your first JSON API endpoint. For more details, you should refer to the project's guide section at GitHub.

At the moment ProcessWire JSON API is a work in progress: there may be changes to the way it works, and it is definitely not considered production ready yet. That being said, we really wanted to provide an early glimpse into it, as it has a lot of promise.

If you'd like to give ProcessWire JSON API a try, you can clone or download it from the pw-json-api GitHub repository, or install it via Composer (composer require fokke/pw-json-api).

Big thanks to Fokke for sharing this project with us!

New module: Wesanox Framework Package

Wesanox Framework Package is a brand-new third party module created for ProcessWire and just added to our modules directory. Created by author wesanox, this module is essentially a loader for some commonly used JavaScript packages, as well as custom ones in case you don't mind dropping them into the module's directory directly.

The Wesanox Framework Package comes with following tools and libraries bundled in:

  • AOS 2.3.1 (Animate on Scroll)
  • Swiper 11.2.8 (Touch slider)
  • Bootstrap 5.3.6 (CSS framework)
  • jQuery 3.7.1

For loading included styles and scripts, the module provides two API methods:

echo $modules->WesanoxFrameworkPackage->renderStyles();
echo $modules->WesanoxFrameworkPackage->renderScripts();

If you'd like to customize the features that are automatically included, the module's README suggests that you should modify the module directly. As such, it might make sense to consider the Wesanox Framework Package as a starting point for your own library loader, that you modify and customize for your specific needs.

If you'd like to give this module a try, you can clone or download the module's source code from the wesanox-framework-package GitHub repository, or install it via the built-in modules manager in the admin. In case you have any questions or suggestions, head down to the Wesanox Framework Package support forum thread.

Big thanks to wesanox for creating this module and sharing it with us — very nice first contribution, keep up the good work!

Site of the week: Bildungswerk Freising

Our latest site of the week is Bildungswerk Freising, a website created by typneun Designagentur for Katholisches Kreisbildungswerk Freising e. V. — a non-profit education institution founded in 1971. They host an average of 1,400 events around a variety of categories per year, and their events have an average of 28,000 yearly participants.

Their website, located at bildungswerk-freising.de, was designed and developed by the team at typneun. It features a clean, modern layout with interesting visual effects and plenty of colorful elements, as well as a responsive, intuitive layout, and a very neatly organized content structure. There's quite a lot of content on this site, as each event has a page of its own with key details, such as a description, dates, location, and fee.

As for behind the scenes details, the front-end of this site appears to be custom-built, or based on a custom-built in-house front-end framework. Some of the familiar third-party elements used on this site include Slick and PhotoSwipe, and there are no signs of familiar third-party ProcessWire modules that we could spot.

Thanks to the folks at typneun Designagentur for sharing this project with us, and our congratulations to the client for their new, ProcessWire powered website!

Stay tuned for our next issue

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