140 commits, 55 resolved issues, dozens of new features, eight contributors, and five new pull requests make yet another great new version of ProcessWire.
This week I’m happy to announce another new main/master branch version of ProcessWire, version 3.0.210. Like most main release versions, there is a lot here. This post covers some of the most notable additions and improvements.
Admin-related improvements
Updated the login form (ProcessLogin) to auto-refresh every 5 minutes of non-activity. This helps to avoid cases where a login form sits for a long period and has its CSRF key expire. It can prevent this error message, which you might have seen before:
“This request was aborted because it appears to be forged.” —Your friend, ProcessWire
Updated ProcessTemplate module so that when you add one (1) new template, it now goes straight to edit the template, rather than back to the template list.
Added support for remembering language tabs focus between requests after a “change all” double-click language tab, via PR from FlipZoomMedia.
Added new page editor Inputfield visibility mode “Tab” which makes any Inputfield display as a page editor tab. The tab options include: 'Tab', 'Tab (AJAX)', and 'Tab (locked)'.
Added new “Usage” fieldset/info on Field edit page primary tab. This shows what templates use the field being edited. While this information is also available in Actions, this addition adds consistency with the Usage info on templates.
Updated the PageFrontEdit module (front-end page editor) to add support for InputfieldTinyMCE.
Added a memory limit check to ProcessWire’s installer.
$page improvements
Added a new $page->getMultiple($keys); method where $keys
can be array or CSV string of properties/fields to return in an array.
$values = $page->getMultiple([ 'title', 'summary' ]);
$values = $page->getMultiple('title,summary'); // same as above
The above returns a regular PHP array (non-associative) by default, specify true as the 2nd argument to get an associative array indexed by given key names:
$values = $page->getMultiple('title,subtitle,body', true);
$page->get() method improvements, including full support of dot syntax (regardless of output formatting state)…
$value = $page->get('field_name.subfield_name.title');
…and support for brackets[]
to force multi-value, returning array or WireArray (according to type) even on single-value fields…
$values = $page->get('field_name[]');
…and the ability to specify indexes to get a single item from a multi-value field, like the first item (index 0) in this example below…
$firstValue = $page->get('field_name[0]');
…and bracketed selectors to filter the multi-value field as you get it…
$values = $page->get('some_multi_value_field[title%=design]');
…and the ability to combine any of these.
Added support for a $page->getPageListLabel();
method which enables custom page classes to return custom markup for the page's label in the page-list.
There was also a significant refactoring of the base Page class, moving a lot of code into a separate PageValues class, thereby reducing the size of the base Page class.
$pages improvements
Updated PagesPathFinder to provide 301 redirect for paths ending with /index.php
, rather than responding with a 404 code.
Added support for FieldtypeOptions fields to $pages->find()
joinFields option (via PR from dadish).
Added support for returning template property values (i.e. template.name
, etc.) in $pages->findRaw().
Inputfield improvements
New renderFlags
option letting you specify that a given Inputfield should render at the top or bottom of its siblings, regardless of its position (like a sticky attribute).
New methods to support adding classes to different elements (wrap, header, content, input) in one call via a string (see addClass() method for details).
New ability to configure classes for the above mentioned elements interactively in the Inputfield configuration. This can be useful in FormBuilder, LoginRegisterPro, and other instances.
Added an allowProcessInput() hook to InputfieldWrapper class. This enables hooks to control whether a given Inputfield can be excluded from input processing at runtime.
Updated inputfields.js for better error handling and improved field reloading support.
Update InputfieldWrapper class to have an error method named getErrorInputfields() that enables you to get Inputfields having errors rather than just getting error messages.
Improvements to the InputfieldForm module, including a new isSubmitted() method for a better way to check form submission, among other minor updates.
Notifications improvements
These are technically both admin-related improvements and API-related improvements.
Now you can include separate label and notice text by calling message/warning/error like this:
$this->message([ 'Notice label' => 'Notice text' ]);
New support for a Notice::allowDuplicate flag which allows duplicate notices to appear when rendered. To use, specify it in the flags argument:
$this->message('notice text', 'duplicate'); // this
$this->message('notice text', Notice::duplicate); // or this
Improved debugging output when passed object or array values for message text.
The Notice icon can now be specified in the notice flags, if using a flags string, i.e.
$this->message('notice text', 'icon-eye-slash');
These can be combined with other flags too of course, i.e.
$this->message('notice text', 'markdown duplicate icon-home');
Comments system improvements
New additions to ProcessCommentsManager module including a new separate dedicated comment editor and the ability to add new comments or replies from within the module.
Upgraded Comments to support custom fields via new meta functions: meta(), setMeta(), getMeta(), removeMeta(). Also upgraded ProcessCommentsManager and InputfieldCommentsAdmin for support.
InputfieldCommentsAdmin was upgraded with an option to link to the comments manager rather than making comments editable in the page editor (see "Input" tab for that config option). This is especially useful in cases where there may be more comments present than is manageable in the page editor.
Added new allowChildren() method to Comment class indicating whether or not replies are allowed to the comment.
Updated comments.js to allow for de-selection of stars in cases where a user might accidentally click on a stars input and want to revert to no-selection.
Other API improvements
Added support for $items[] = $item;
append syntax to WireArray/PageArray. This enables you to add items to a WireArray or PageArray similar to how you would with a regular PHP array.
$items = WireArray();
$items[] = $item1;
$items[] = $item2;
$items[] = $item3;
Updated the $templates->delete($template) method to also delete fieldgroup having the same name as the template (when that fieldgroup is not used elsewhere).
Added a $hookable
option to the wireMethodExists() function, enabling it to detect cases where the method may exist in a ___hookable()
variation.
Updated the $sanitizer->email() method to add IDN, UTF-8, ASCII, and DNS support options.
Added a Debug::toStr() method for dumping any variable to a string (for debugging purposes)
Added new FieldtypeHasPagefiles and FieldtypeHasPageimages interfaces and update FieldtypeFile/Image to support them. These interfaces enable a Fieldtype to communicate that it manages Pagefile/Pageimage objects and provides a method for retrieving them.
A big thanks to our growing list of contributors. Above is just a list of notable features and improvements added in this version. But this version includes a lot more than that. We didn't cover the numerous individual issue resolutions and other minor improvements and optimizations (and there were a lot of them).
Also worth noting is that the development of InputfieldTinyMCE is perhaps one of the biggest recent additions in ProcessWire, but is not part of this core version. It will be merged into the dev branch shortly and be part of the next main/master release after this. So this is likely the last tagged release that will be CKEditor exclusive, while following versions will include both TinyMCE and CKEditor. Some time after CKEditor 4.x is officially EOL it will be moved out of the core and maintained in the modules directory.
Thanks for reading! We hope you enjoy this new version, please let us know it works for you. For more ProcessWire news and updates be sure to read the ProcessWire Weekly.
Download master (3.0.229) Download dev (3.0.242)
Comments
Brendon
As is often the case with your updates, Ryan -- I was just this past week searching for something equivalent to $page->getMultiple($keys)! The overloading for array append syntax to WireArray/PageArray will also certainly come in handy, among many of the other improvements. Thanks so much to all contributors!
Reply
HMCB
- 2 years ago
- 32
★★★★★What an amazing update. I’m a week late but all this is truly appreciated.
Reply